<!-- HTML header for doxygen 1.8.8-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <!-- For Mobile Devices -->
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
        <meta name="generator" content="Doxygen 1.8.18"/>
        <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
        <title>HElib: /HElib/include/helib/ArgMap.h Source File</title>
        <!--<link href="tabs.css" rel="stylesheet" type="text/css"/>-->
        <script type="text/javascript" src="dynsections.js"></script>
        <link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
        <link href="doxygen.css" rel="stylesheet" type="text/css" />
        <link href="customdoxygen.css" rel="stylesheet" type="text/css"/>
        <link href='https://fonts.googleapis.com/css?family=Roboto+Slab' rel='stylesheet' type='text/css'>
		<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:ital,wght@0,100;1,700&family=Merriweather&family=Merriweather+Sans&family=Open+Sans&family=Poppins:ital@1&family=Roboto:ital,wght@0,400;1,300;1,900&display=swap" rel="stylesheet"> 
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
        <link href="jquery.smartmenus.bootstrap.css" rel="stylesheet">
        <script type="text/javascript" src="jquery.smartmenus.js"></script>
        <!-- SmartMenus jQuery Bootstrap Addon -->
        <script type="text/javascript" src="jquery.smartmenus.bootstrap.js"></script>
        <!-- SmartMenus jQuery plugin -->
    </head>
    <body style="font-family: 'Merriweather', serif;">
        <nav class="navbar navbar-default" role="navigation">
            <div class="container">
                <div class="navbar-header">
                    <a class="navbar-brand">HElib Implementing Homomorphic Encryption</a>
                </div>
            </div>
        </nav>
        <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
            <div class="content" id="content">
                <div class="container">
                    <div class="row">
                        <div class="col-sm-12 panel " style="padding-bottom: 15px;">
                            <div style="margin-bottom: 15px;">
<!-- end header part -->
<!-- Generated by Doxygen 1.8.18 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_d0c4ae63660968bf6b1c77a1e8aecf95.html">helib</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">ArgMap.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="_arg_map_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/* Copyright (C) 2012-2020 IBM Corp.</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment"> * This program is Licensed under the Apache License, Version 2.0</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"> * (the &quot;License&quot;); you may not use this file except in compliance</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment"> * with the License. You may obtain a copy of the License at</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"> *   http://www.apache.org/licenses/LICENSE-2.0</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment"> * Unless required by applicable law or agreed to in writing, software</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="comment"> * distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment"> * See the License for the specific language governing permissions and</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment"> * limitations under the License. See accompanying LICENSE file.</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160; </div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor">#ifndef HELIB_ARGMAP_H</span></div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="preprocessor">#define HELIB_ARGMAP_H</span></div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160; </div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="preprocessor">#include &lt;iostream&gt;</span></div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="preprocessor">#include &lt;iomanip&gt;</span></div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="preprocessor">#include &lt;forward_list&gt;</span></div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="preprocessor">#include &lt;initializer_list&gt;</span></div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="preprocessor">#include &lt;set&gt;</span></div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="preprocessor">#include &lt;unordered_map&gt;</span></div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="preprocessor">#include &lt;algorithm&gt;</span></div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="preprocessor">#include &lt;functional&gt;</span></div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="preprocessor">#include &lt;string&gt;</span></div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;<span class="preprocessor">#include &lt;sstream&gt;</span></div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;<span class="preprocessor">#include &lt;fstream&gt;</span></div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;<span class="preprocessor">#include &lt;cctype&gt;</span></div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<span class="preprocessor">#include &lt;memory&gt;</span></div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;<span class="preprocessor">#include &lt;vector&gt;</span></div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;<span class="preprocessor">#include &lt;tuple&gt;</span></div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;<span class="preprocessor">#include &lt;type_traits&gt;</span></div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;<span class="preprocessor">#include &lt;regex&gt;</span></div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="assertions_8h.html">helib/assertions.h</a>&gt;</span></div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160; </div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespacehelib.html">helib</a> {</div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160; </div>
<div class="line"><a name="l00072"></a><span class="lineno"><a class="line" href="classhelib_1_1_arg_map.html">   72</a></span>&#160;<span class="keyword">class </span><a class="code" href="classhelib_1_1_arg_map.html">ArgMap</a></div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;{</div>
<div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;  <span class="keyword">enum class</span> ArgType</div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;  {</div>
<div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;    NAMED,</div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;    TOGGLE_TRUE,</div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;    TOGGLE_FALSE,</div>
<div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;    POSITIONAL,</div>
<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;    DOTS</div>
<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;  };</div>
<div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160; </div>
<div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;  <span class="comment">// requires latching logic.</span></div>
<div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;  <span class="keyword">class </span>PositionalArgsList</div>
<div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;  {</div>
<div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;  <span class="keyword">private</span>:</div>
<div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;    std::vector&lt;std::string&gt; positional_args;</div>
<div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;    <span class="keywordtype">bool</span> optional_flag = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160; </div>
<div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;  <span class="keyword">public</span>:</div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;    <span class="keywordtype">void</span> insert(std::string name, <span class="keywordtype">bool</span> <a class="code" href="classhelib_1_1_arg_map.html#a39ddbc25b7e1b038dbab65d5c1383b50">optional</a>)</div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;    {</div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;      <span class="keywordflow">if</span> (<a class="code" href="classhelib_1_1_arg_map.html#a39ddbc25b7e1b038dbab65d5c1383b50">optional</a>) {</div>
<div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;        this-&gt;optional_flag = <span class="keyword">true</span>;</div>
<div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;        positional_args.push_back(name);</div>
<div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;      } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (!<a class="code" href="classhelib_1_1_arg_map.html#a39ddbc25b7e1b038dbab65d5c1383b50">optional</a> &amp;&amp; !optional_flag) {</div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;        positional_args.push_back(name);</div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;      } <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;        <span class="keywordflow">throw</span> <a class="code" href="classhelib_1_1_logic_error.html">LogicError</a>(<span class="stringliteral">&quot;Attempting to have argument &#39;&quot;</span> + name +</div>
<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;                         <span class="stringliteral">&quot;&#39; required after optional positional args given.&quot;</span>);</div>
<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;      }</div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;    }</div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160; </div>
<div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;    std::vector&lt;std::string&gt;::iterator begin()</div>
<div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;    {</div>
<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;      <span class="keywordflow">return</span> this-&gt;positional_args.begin();</div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;    }</div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160; </div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;    std::vector&lt;std::string&gt;::iterator end()</div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;    {</div>
<div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;      <span class="keywordflow">return</span> this-&gt;positional_args.end();</div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;    }</div>
<div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160; </div>
<div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="namespacehelib.html#ad94835a294c90ee0ea0336561c8f38ad">empty</a>() { <span class="keywordflow">return</span> this-&gt;positional_args.empty(); }</div>
<div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;  }; <span class="comment">// end of PositionalArgsList</span></div>
<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160; </div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;  <span class="keyword">struct </span><a class="code" href="structhelib_1_1_arg_map_1_1_arg_processor.html">ArgProcessor</a>;</div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160; </div>
<div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;  <span class="keyword">template</span> &lt;<span class="keyword">typename</span> C&gt;</div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;  <span class="keyword">class </span>ArgProcessorContainer;</div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160; </div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;  <span class="comment">/* ArgProcessorValue: templated subclasses */</span></div>
<div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;  <span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;  <span class="keyword">class </span>ArgProcessorValue;</div>
<div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160; </div>
<div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;  ArgType arg_type = ArgType::NAMED;</div>
<div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;  <span class="keywordtype">char</span> kv_separator = <span class="charliteral">&#39;=&#39;</span>;</div>
<div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;  <span class="comment">// Modes and other flags.</span></div>
<div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;  <span class="keywordtype">bool</span> required_mode = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;  <span class="keywordtype">bool</span> dots_enabled = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;  <span class="keywordtype">bool</span> named_args_only = <span class="keyword">true</span>;</div>
<div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160; </div>
<div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;  std::string progname;</div>
<div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;  std::string dots_name;</div>
<div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160; </div>
<div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;  <span class="comment">// Track addresses to stop assigning same variable to more than one .arg(...)</span></div>
<div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;  std::set&lt;void*&gt; addresses_used;</div>
<div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160; </div>
<div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;  <span class="comment">// Track what has been called previously whilst parsing.</span></div>
<div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;  std::set&lt;std::string&gt; previous_call_set;</div>
<div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160; </div>
<div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;  <span class="comment">// Store the args.</span></div>
<div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;  std::unordered_map&lt;std::string, std::shared_ptr&lt;ArgProcessor&gt;&gt; map;</div>
<div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160; </div>
<div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;  <span class="comment">// Docs held in vector until called by methods such as doc and usage</span></div>
<div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;  <span class="comment">// Triple (arg name (+ value),  docString, whether required)</span></div>
<div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;  std::vector&lt;std::tuple&lt;std::string, std::string, bool&gt;&gt; docVec;</div>
<div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160; </div>
<div class="line"><a name="l00151"></a><span class="lineno">  151</span>&#160;  PositionalArgsList positional_args_list;</div>
<div class="line"><a name="l00152"></a><span class="lineno">  152</span>&#160; </div>
<div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160;  std::unique_ptr&lt;ArgProcessor&gt; dots_ap;</div>
<div class="line"><a name="l00154"></a><span class="lineno">  154</span>&#160; </div>
<div class="line"><a name="l00155"></a><span class="lineno">  155</span>&#160;  <span class="comment">// Set for tracking required.</span></div>
<div class="line"><a name="l00156"></a><span class="lineno">  156</span>&#160;  std::set&lt;std::string&gt; required_set;</div>
<div class="line"><a name="l00157"></a><span class="lineno">  157</span>&#160; </div>
<div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;  <span class="comment">// Set for tracking optional.</span></div>
<div class="line"><a name="l00159"></a><span class="lineno">  159</span>&#160;  std::set&lt;std::string&gt; optional_set;</div>
<div class="line"><a name="l00160"></a><span class="lineno">  160</span>&#160; </div>
<div class="line"><a name="l00161"></a><span class="lineno">  161</span>&#160;  std::ostream* diagnostics_strm = <span class="keyword">nullptr</span>;</div>
<div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160; </div>
<div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160;  std::set&lt;std::string&gt; help_tokens = {<span class="stringliteral">&quot;-h&quot;</span>, <span class="stringliteral">&quot;--help&quot;</span>};</div>
<div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160; </div>
<div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;  <span class="comment">// Private for diagnostics</span></div>
<div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;  <span class="keywordtype">void</span> printDiagnostics(<span class="keyword">const</span> std::forward_list&lt;std::string&gt;&amp; args) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160; </div>
<div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160; </div>
<div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;  <span class="keywordtype">void</span> simpleParse(<span class="keyword">const</span> std::forward_list&lt;std::string&gt;&amp; args,</div>
<div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160;                   <span class="keywordtype">bool</span> duplicates = <span class="keyword">true</span>,</div>
<div class="line"><a name="l00177"></a><span class="lineno">  177</span>&#160;                   std::function&lt;<span class="keywordtype">void</span>(<span class="keyword">const</span> std::string&amp;)&gt; stop = {});</div>
<div class="line"><a name="l00178"></a><span class="lineno">  178</span>&#160; </div>
<div class="line"><a name="l00179"></a><span class="lineno">  179</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00180"></a><span class="lineno"><a class="line" href="classhelib_1_1_arg_map.html#ac96d090b5476e9a39b41ae27d74641b0">  180</a></span>&#160;  <span class="keyword">enum class</span> <a class="code" href="classhelib_1_1_arg_map.html#ac96d090b5476e9a39b41ae27d74641b0">Separator</a></div>
<div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160;  {</div>
<div class="line"><a name="l00182"></a><span class="lineno">  182</span>&#160;    <a class="code" href="classhelib_1_1_arg_map.html#ac96d090b5476e9a39b41ae27d74641b0af65f22e75defc168edfc6444e6aaf4f8">COLON</a>,</div>
<div class="line"><a name="l00183"></a><span class="lineno">  183</span>&#160;    <a class="code" href="classhelib_1_1_arg_map.html#ac96d090b5476e9a39b41ae27d74641b0a6837aeca94b8f55801166eb031e26a5a">EQUALS</a>,</div>
<div class="line"><a name="l00184"></a><span class="lineno">  184</span>&#160;    <a class="code" href="classhelib_1_1_arg_map.html#ac96d090b5476e9a39b41ae27d74641b0a52f1e315372b38db1b8f4e3666c4f721">WHITESPACE</a></div>
<div class="line"><a name="l00185"></a><span class="lineno">  185</span>&#160;  };</div>
<div class="line"><a name="l00186"></a><span class="lineno">  186</span>&#160; </div>
<div class="line"><a name="l00198"></a><span class="lineno">  198</span>&#160;  <span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00199"></a><span class="lineno">  199</span>&#160;  <a class="code" href="classhelib_1_1_arg_map.html">ArgMap</a>&amp; <a class="code" href="classhelib_1_1_arg_map.html#a72a8c34a4d72036f02d3bb3cc6f754d2">arg</a>(<span class="keyword">const</span> std::string&amp; name, T&amp; value);</div>
<div class="line"><a name="l00200"></a><span class="lineno">  200</span>&#160; </div>
<div class="line"><a name="l00213"></a><span class="lineno">  213</span>&#160;  <span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00214"></a><span class="lineno">  214</span>&#160;  <a class="code" href="classhelib_1_1_arg_map.html">ArgMap</a>&amp; <a class="code" href="classhelib_1_1_arg_map.html#a72a8c34a4d72036f02d3bb3cc6f754d2">arg</a>(<span class="keyword">const</span> std::string&amp; name, T&amp; value, <span class="keyword">const</span> std::string&amp; <a class="code" href="classhelib_1_1_arg_map.html#a7665dba84ba3a420e052a61eb6c4e30f">doc</a>);</div>
<div class="line"><a name="l00215"></a><span class="lineno">  215</span>&#160; </div>
<div class="line"><a name="l00229"></a><span class="lineno">  229</span>&#160;  <span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00230"></a><span class="lineno">  230</span>&#160;  <a class="code" href="classhelib_1_1_arg_map.html">ArgMap</a>&amp; <a class="code" href="classhelib_1_1_arg_map.html#a72a8c34a4d72036f02d3bb3cc6f754d2">arg</a>(<span class="keyword">const</span> std::string&amp; name,</div>
<div class="line"><a name="l00231"></a><span class="lineno">  231</span>&#160;              T&amp; value,</div>
<div class="line"><a name="l00232"></a><span class="lineno">  232</span>&#160;              <span class="keyword">const</span> std::string&amp; <a class="code" href="classhelib_1_1_arg_map.html#a7665dba84ba3a420e052a61eb6c4e30f">doc</a>,</div>
<div class="line"><a name="l00233"></a><span class="lineno">  233</span>&#160;              <span class="keyword">const</span> <span class="keywordtype">char</span>* info);</div>
<div class="line"><a name="l00234"></a><span class="lineno">  234</span>&#160; </div>
<div class="line"><a name="l00242"></a><span class="lineno">  242</span>&#160;  <span class="keyword">template</span> &lt;<span class="keyword">typename</span> C&gt;</div>
<div class="line"><a name="l00243"></a><span class="lineno">  243</span>&#160;  <a class="code" href="classhelib_1_1_arg_map.html">ArgMap</a>&amp; <a class="code" href="classhelib_1_1_arg_map.html#a8e2a662a2283329301f6d7b5e0e845c8">dots</a>(C&amp; container, <span class="keyword">const</span> <span class="keywordtype">char</span>* name);</div>
<div class="line"><a name="l00244"></a><span class="lineno">  244</span>&#160; </div>
<div class="line"><a name="l00253"></a><span class="lineno">  253</span>&#160;  <a class="code" href="classhelib_1_1_arg_map.html">ArgMap</a>&amp; <a class="code" href="classhelib_1_1_arg_map.html#a89eee5d391a2fd41b6b6c4b545b159b7">parse</a>(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span>** argv);</div>
<div class="line"><a name="l00254"></a><span class="lineno">  254</span>&#160; </div>
<div class="line"><a name="l00263"></a><span class="lineno">  263</span>&#160;  <a class="code" href="classhelib_1_1_arg_map.html">ArgMap</a>&amp; <a class="code" href="classhelib_1_1_arg_map.html#a89eee5d391a2fd41b6b6c4b545b159b7">parse</a>(<span class="keyword">const</span> std::string&amp; filepath);</div>
<div class="line"><a name="l00264"></a><span class="lineno">  264</span>&#160; </div>
<div class="line"><a name="l00270"></a><span class="lineno">  270</span>&#160;  <a class="code" href="classhelib_1_1_arg_map.html">ArgMap</a>&amp; <a class="code" href="classhelib_1_1_arg_map.html#a39ddbc25b7e1b038dbab65d5c1383b50">optional</a>();</div>
<div class="line"><a name="l00271"></a><span class="lineno">  271</span>&#160; </div>
<div class="line"><a name="l00277"></a><span class="lineno">  277</span>&#160;  <a class="code" href="classhelib_1_1_arg_map.html">ArgMap</a>&amp; <a class="code" href="classhelib_1_1_arg_map.html#aa7dcd50df0466cd4be10a94eb3f96d1b">required</a>();</div>
<div class="line"><a name="l00278"></a><span class="lineno">  278</span>&#160; </div>
<div class="line"><a name="l00285"></a><span class="lineno">  285</span>&#160;  <a class="code" href="classhelib_1_1_arg_map.html">ArgMap</a>&amp; <a class="code" href="classhelib_1_1_arg_map.html#af838c44fcb91c73284de3cbf993861f2">toggle</a>(<span class="keywordtype">bool</span> t = <span class="keyword">true</span>);</div>
<div class="line"><a name="l00286"></a><span class="lineno">  286</span>&#160; </div>
<div class="line"><a name="l00293"></a><span class="lineno">  293</span>&#160;  <a class="code" href="classhelib_1_1_arg_map.html">ArgMap</a>&amp; <a class="code" href="classhelib_1_1_arg_map.html#ac06dd5e3726ecd5d8e688d665c2c9e50">named</a>();</div>
<div class="line"><a name="l00294"></a><span class="lineno">  294</span>&#160; </div>
<div class="line"><a name="l00301"></a><span class="lineno">  301</span>&#160;  <a class="code" href="classhelib_1_1_arg_map.html">ArgMap</a>&amp; <a class="code" href="classhelib_1_1_arg_map.html#adf55e7e52a63bd72fe212cb90e58ad64">positional</a>();</div>
<div class="line"><a name="l00302"></a><span class="lineno">  302</span>&#160; </div>
<div class="line"><a name="l00308"></a><span class="lineno">  308</span>&#160;  <a class="code" href="classhelib_1_1_arg_map.html">ArgMap</a>&amp; <a class="code" href="classhelib_1_1_arg_map.html#a0ecab734381e89bf13e2dd38af25585c">helpArgs</a>(<span class="keyword">const</span> std::initializer_list&lt;std::string&gt; s);</div>
<div class="line"><a name="l00309"></a><span class="lineno">  309</span>&#160;  <a class="code" href="classhelib_1_1_arg_map.html">ArgMap</a>&amp; <a class="code" href="classhelib_1_1_arg_map.html#a0ecab734381e89bf13e2dd38af25585c">helpArgs</a>(<span class="keyword">const</span> std::string s);</div>
<div class="line"><a name="l00310"></a><span class="lineno">  310</span>&#160; </div>
<div class="line"><a name="l00317"></a><span class="lineno">  317</span>&#160;  <a class="code" href="classhelib_1_1_arg_map.html">ArgMap</a>&amp; <a class="code" href="classhelib_1_1_arg_map.html#af54e2d261ed329d3b3b2e2cfbf35ab80">diagnostics</a>(std::ostream&amp; ostrm = std::cout);</div>
<div class="line"><a name="l00318"></a><span class="lineno">  318</span>&#160; </div>
<div class="line"><a name="l00325"></a><span class="lineno">  325</span>&#160;  <a class="code" href="classhelib_1_1_arg_map.html">ArgMap</a>&amp; <a class="code" href="classhelib_1_1_arg_map.html#ae477d3e97e6b9f4e847b7976fc939992">separator</a>(<a class="code" href="classhelib_1_1_arg_map.html#ac96d090b5476e9a39b41ae27d74641b0">Separator</a> s);</div>
<div class="line"><a name="l00326"></a><span class="lineno">  326</span>&#160; </div>
<div class="line"><a name="l00333"></a><span class="lineno">  333</span>&#160;  <a class="code" href="classhelib_1_1_arg_map.html">ArgMap</a>&amp; <a class="code" href="classhelib_1_1_arg_map.html#a7bcbfcccc0c9fcc9f3eba06067fcd97f">note</a>(<span class="keyword">const</span> std::string&amp; s);</div>
<div class="line"><a name="l00334"></a><span class="lineno">  334</span>&#160; </div>
<div class="line"><a name="l00340"></a><span class="lineno">  340</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_arg_map.html#a383d5eb53291ab618eebeb60c2112dde">usage</a>(<span class="keyword">const</span> std::string&amp; msg = <span class="stringliteral">&quot;&quot;</span>) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00341"></a><span class="lineno">  341</span>&#160; </div>
<div class="line"><a name="l00347"></a><span class="lineno">  347</span>&#160;  std::string <a class="code" href="classhelib_1_1_arg_map.html#a7665dba84ba3a420e052a61eb6c4e30f">doc</a>() <span class="keyword">const</span>;</div>
<div class="line"><a name="l00348"></a><span class="lineno">  348</span>&#160;}; <span class="comment">// End of class ArgMap</span></div>
<div class="line"><a name="l00349"></a><span class="lineno">  349</span>&#160; </div>
<div class="line"><a name="l00350"></a><span class="lineno">  350</span>&#160;<span class="comment">// Three functions strip whitespaces before and after strings.</span></div>
<div class="line"><a name="l00351"></a><span class="lineno">  351</span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> lstrip(std::string&amp; s)</div>
<div class="line"><a name="l00352"></a><span class="lineno">  352</span>&#160;{</div>
<div class="line"><a name="l00353"></a><span class="lineno">  353</span>&#160;  <span class="keyword">auto</span> it = std::find_if(s.begin(), s.end(), [](<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> c) {</div>
<div class="line"><a name="l00354"></a><span class="lineno">  354</span>&#160;    return !std::isspace(c);</div>
<div class="line"><a name="l00355"></a><span class="lineno">  355</span>&#160;  });</div>
<div class="line"><a name="l00356"></a><span class="lineno">  356</span>&#160; </div>
<div class="line"><a name="l00357"></a><span class="lineno">  357</span>&#160;  s.erase(s.begin(), it);</div>
<div class="line"><a name="l00358"></a><span class="lineno">  358</span>&#160;}</div>
<div class="line"><a name="l00359"></a><span class="lineno">  359</span>&#160; </div>
<div class="line"><a name="l00360"></a><span class="lineno">  360</span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> rstrip(std::string&amp; s)</div>
<div class="line"><a name="l00361"></a><span class="lineno">  361</span>&#160;{</div>
<div class="line"><a name="l00362"></a><span class="lineno">  362</span>&#160;  <span class="keyword">auto</span> it = std::find_if(s.rbegin(), s.rend(), [](<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> c) {</div>
<div class="line"><a name="l00363"></a><span class="lineno">  363</span>&#160;    return !std::isspace(c);</div>
<div class="line"><a name="l00364"></a><span class="lineno">  364</span>&#160;  });</div>
<div class="line"><a name="l00365"></a><span class="lineno">  365</span>&#160; </div>
<div class="line"><a name="l00366"></a><span class="lineno">  366</span>&#160;  s.erase(it.base(), s.end());</div>
<div class="line"><a name="l00367"></a><span class="lineno">  367</span>&#160;}</div>
<div class="line"><a name="l00368"></a><span class="lineno">  368</span>&#160; </div>
<div class="line"><a name="l00369"></a><span class="lineno">  369</span>&#160;<span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> strip(std::string&amp; s)</div>
<div class="line"><a name="l00370"></a><span class="lineno">  370</span>&#160;{</div>
<div class="line"><a name="l00371"></a><span class="lineno">  371</span>&#160;  lstrip(s);</div>
<div class="line"><a name="l00372"></a><span class="lineno">  372</span>&#160;  rstrip(s);</div>
<div class="line"><a name="l00373"></a><span class="lineno">  373</span>&#160;}</div>
<div class="line"><a name="l00374"></a><span class="lineno">  374</span>&#160; </div>
<div class="line"><a name="l00375"></a><span class="lineno">  375</span>&#160;<span class="comment">// Correct the list from argv by splitting on the separator.</span></div>
<div class="line"><a name="l00376"></a><span class="lineno">  376</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> splitOnSeparator(std::forward_list&lt;std::string&gt;&amp; args_lst, <span class="keywordtype">char</span> sep)</div>
<div class="line"><a name="l00377"></a><span class="lineno">  377</span>&#160;{</div>
<div class="line"><a name="l00378"></a><span class="lineno">  378</span>&#160;  <span class="keywordflow">if</span> (sep == <span class="charliteral">&#39; &#39;</span>)</div>
<div class="line"><a name="l00379"></a><span class="lineno">  379</span>&#160;    <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00380"></a><span class="lineno">  380</span>&#160; </div>
<div class="line"><a name="l00381"></a><span class="lineno">  381</span>&#160;  <span class="keywordflow">for</span> (<span class="keyword">auto</span> it = args_lst.begin(); it != args_lst.end(); ++it) {</div>
<div class="line"><a name="l00382"></a><span class="lineno">  382</span>&#160;    <span class="keywordflow">if</span> (it-&gt;size() != 1) {</div>
<div class="line"><a name="l00383"></a><span class="lineno">  383</span>&#160;      std::size_t pos = it-&gt;find(sep);</div>
<div class="line"><a name="l00384"></a><span class="lineno">  384</span>&#160;      <span class="keywordflow">if</span> (pos != std::string::npos) {</div>
<div class="line"><a name="l00385"></a><span class="lineno">  385</span>&#160;        <span class="keywordflow">if</span> (pos == 0) {</div>
<div class="line"><a name="l00386"></a><span class="lineno">  386</span>&#160;          std::string <a class="code" href="namespacehelib.html#a305064dc4866c160a571bd653556c113">sub</a> = it-&gt;substr(1, std::string::npos);</div>
<div class="line"><a name="l00387"></a><span class="lineno">  387</span>&#160;          *it = sep;</div>
<div class="line"><a name="l00388"></a><span class="lineno">  388</span>&#160;          args_lst.insert_after(it, <a class="code" href="namespacehelib.html#a305064dc4866c160a571bd653556c113">sub</a>);</div>
<div class="line"><a name="l00389"></a><span class="lineno">  389</span>&#160;        } <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00390"></a><span class="lineno">  390</span>&#160;          std::string <a class="code" href="namespacehelib.html#a305064dc4866c160a571bd653556c113">sub</a> = it-&gt;substr(pos);</div>
<div class="line"><a name="l00391"></a><span class="lineno">  391</span>&#160;          *it = it-&gt;substr(0, pos);</div>
<div class="line"><a name="l00392"></a><span class="lineno">  392</span>&#160;          args_lst.insert_after(it, <a class="code" href="namespacehelib.html#a305064dc4866c160a571bd653556c113">sub</a>);</div>
<div class="line"><a name="l00393"></a><span class="lineno">  393</span>&#160;        }</div>
<div class="line"><a name="l00394"></a><span class="lineno">  394</span>&#160;      }</div>
<div class="line"><a name="l00395"></a><span class="lineno">  395</span>&#160;    }</div>
<div class="line"><a name="l00396"></a><span class="lineno">  396</span>&#160;  }</div>
<div class="line"><a name="l00397"></a><span class="lineno">  397</span>&#160;}</div>
<div class="line"><a name="l00398"></a><span class="lineno">  398</span>&#160; </div>
<div class="line"><a name="l00399"></a><span class="lineno">  399</span>&#160;<span class="comment">/* ArgProcessor: A virtual base class that acts as the interface to hold</span></div>
<div class="line"><a name="l00400"></a><span class="lineno">  400</span>&#160;<span class="comment"> * args in a map of different types.</span></div>
<div class="line"><a name="l00401"></a><span class="lineno">  401</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00402"></a><span class="lineno"><a class="line" href="structhelib_1_1_arg_map_1_1_arg_processor.html">  402</a></span>&#160;<span class="keyword">struct </span><a class="code" href="structhelib_1_1_arg_map_1_1_arg_processor.html">ArgMap::ArgProcessor</a></div>
<div class="line"><a name="l00403"></a><span class="lineno">  403</span>&#160;{</div>
<div class="line"><a name="l00404"></a><span class="lineno"><a class="line" href="structhelib_1_1_arg_map_1_1_arg_processor.html#afdec15131d585403483783f150f90bb6">  404</a></span>&#160;  <span class="keyword">virtual</span> <a class="code" href="structhelib_1_1_arg_map_1_1_arg_processor.html#afdec15131d585403483783f150f90bb6">~ArgProcessor</a>() = <span class="keywordflow">default</span>;</div>
<div class="line"><a name="l00405"></a><span class="lineno"><a class="line" href="structhelib_1_1_arg_map_1_1_arg_processor.html#a76d699586ece388055ccd708a273bfbf">  405</a></span>&#160;  <span class="keyword">virtual</span> ArgType <a class="code" href="structhelib_1_1_arg_map_1_1_arg_processor.html#a76d699586ece388055ccd708a273bfbf">getArgType</a>() = 0;</div>
<div class="line"><a name="l00406"></a><span class="lineno"><a class="line" href="structhelib_1_1_arg_map_1_1_arg_processor.html#a19c15b33dcfd8ee176b1e6c22d1afe68">  406</a></span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="structhelib_1_1_arg_map_1_1_arg_processor.html#a19c15b33dcfd8ee176b1e6c22d1afe68">process</a>(<span class="keyword">const</span> std::string&amp; s) = 0;</div>
<div class="line"><a name="l00407"></a><span class="lineno">  407</span>&#160;}; <span class="comment">// end of ArgProcessor</span></div>
<div class="line"><a name="l00408"></a><span class="lineno">  408</span>&#160; </div>
<div class="line"><a name="l00409"></a><span class="lineno">  409</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> C&gt;</div>
<div class="line"><a name="l00410"></a><span class="lineno">  410</span>&#160;<span class="keyword">class </span>ArgMap::ArgProcessorContainer : <span class="keyword">public</span> <a class="code" href="structhelib_1_1_arg_map_1_1_arg_processor.html">ArgProcessor</a></div>
<div class="line"><a name="l00411"></a><span class="lineno">  411</span>&#160;{</div>
<div class="line"><a name="l00412"></a><span class="lineno">  412</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00413"></a><span class="lineno">  413</span>&#160;  C* container;</div>
<div class="line"><a name="l00414"></a><span class="lineno">  414</span>&#160;  ArgType arg_type = ArgType::DOTS;</div>
<div class="line"><a name="l00415"></a><span class="lineno">  415</span>&#160; </div>
<div class="line"><a name="l00416"></a><span class="lineno">  416</span>&#160;  <span class="keyword">using</span> T = <span class="keyword">typename</span> C::value_type;</div>
<div class="line"><a name="l00417"></a><span class="lineno">  417</span>&#160; </div>
<div class="line"><a name="l00418"></a><span class="lineno">  418</span>&#160;  <span class="comment">// For strings. Avoids a stream breaking on whitespace.</span></div>
<div class="line"><a name="l00419"></a><span class="lineno">  419</span>&#160;  <span class="keyword">template</span> &lt;<span class="keyword">typename</span> U = T,</div>
<div class="line"><a name="l00420"></a><span class="lineno">  420</span>&#160;            <span class="keyword">typename</span> S,</div>
<div class="line"><a name="l00421"></a><span class="lineno">  421</span>&#160;            <span class="keyword">typename</span> std::enable_if_t&lt;std::is_same&lt;U, S&gt;::value, <span class="keywordtype">int</span>&gt; = 0&gt;</div>
<div class="line"><a name="l00422"></a><span class="lineno">  422</span>&#160;  <span class="keywordtype">bool</span> do_process(<span class="keyword">const</span> S&amp; s)</div>
<div class="line"><a name="l00423"></a><span class="lineno">  423</span>&#160;  {</div>
<div class="line"><a name="l00424"></a><span class="lineno">  424</span>&#160;    container-&gt;push_back(s);</div>
<div class="line"><a name="l00425"></a><span class="lineno">  425</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00426"></a><span class="lineno">  426</span>&#160;  }</div>
<div class="line"><a name="l00427"></a><span class="lineno">  427</span>&#160; </div>
<div class="line"><a name="l00428"></a><span class="lineno">  428</span>&#160;  <span class="comment">// For non-string types, at the mercy of stringstream.</span></div>
<div class="line"><a name="l00429"></a><span class="lineno">  429</span>&#160;  <span class="keyword">template</span> &lt;<span class="keyword">typename</span> U = T,</div>
<div class="line"><a name="l00430"></a><span class="lineno">  430</span>&#160;            <span class="keyword">typename</span> S,</div>
<div class="line"><a name="l00431"></a><span class="lineno">  431</span>&#160;            <span class="keyword">typename</span> std::enable_if_t&lt;!std::is_same&lt;U, S&gt;::value, <span class="keywordtype">int</span>&gt; = 0&gt;</div>
<div class="line"><a name="l00432"></a><span class="lineno">  432</span>&#160;  <span class="keywordtype">bool</span> do_process(<span class="keyword">const</span> S&amp; s)</div>
<div class="line"><a name="l00433"></a><span class="lineno">  433</span>&#160;  {</div>
<div class="line"><a name="l00434"></a><span class="lineno">  434</span>&#160;    std::istringstream iss(s);</div>
<div class="line"><a name="l00435"></a><span class="lineno">  435</span>&#160;    U tmp_value;</div>
<div class="line"><a name="l00436"></a><span class="lineno">  436</span>&#160;    <span class="keywordtype">bool</span> rt = (iss &gt;&gt; tmp_value);</div>
<div class="line"><a name="l00437"></a><span class="lineno">  437</span>&#160;    container-&gt;push_back(tmp_value);</div>
<div class="line"><a name="l00438"></a><span class="lineno">  438</span>&#160;    <span class="keywordflow">return</span> rt;</div>
<div class="line"><a name="l00439"></a><span class="lineno">  439</span>&#160;  }</div>
<div class="line"><a name="l00440"></a><span class="lineno">  440</span>&#160; </div>
<div class="line"><a name="l00441"></a><span class="lineno">  441</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00442"></a><span class="lineno">  442</span>&#160;  ArgType getArgType()<span class="keyword"> override </span>{ <span class="keywordflow">return</span> arg_type; }</div>
<div class="line"><a name="l00443"></a><span class="lineno">  443</span>&#160; </div>
<div class="line"><a name="l00444"></a><span class="lineno">  444</span>&#160;  <span class="keywordtype">bool</span> process(<span class="keyword">const</span> std::string&amp; s)<span class="keyword"> override </span>{ <span class="keywordflow">return</span> this-&gt;do_process(s); }</div>
<div class="line"><a name="l00445"></a><span class="lineno">  445</span>&#160; </div>
<div class="line"><a name="l00446"></a><span class="lineno">  446</span>&#160;  <span class="keyword">explicit</span> ArgProcessorContainer(C* c) : container(c) {}</div>
<div class="line"><a name="l00447"></a><span class="lineno">  447</span>&#160; </div>
<div class="line"><a name="l00448"></a><span class="lineno">  448</span>&#160;}; <span class="comment">// end of ArgProcessorContainer</span></div>
<div class="line"><a name="l00449"></a><span class="lineno">  449</span>&#160; </div>
<div class="line"><a name="l00450"></a><span class="lineno">  450</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00451"></a><span class="lineno">  451</span>&#160;<span class="keyword">class </span>ArgMap::ArgProcessorValue : <span class="keyword">public</span> ArgProcessor</div>
<div class="line"><a name="l00452"></a><span class="lineno">  452</span>&#160;{</div>
<div class="line"><a name="l00453"></a><span class="lineno">  453</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00454"></a><span class="lineno">  454</span>&#160;  T* value;</div>
<div class="line"><a name="l00455"></a><span class="lineno">  455</span>&#160;  ArgType arg_type;</div>
<div class="line"><a name="l00456"></a><span class="lineno">  456</span>&#160; </div>
<div class="line"><a name="l00457"></a><span class="lineno">  457</span>&#160;  <span class="comment">// For strings. Avoids a stream breaking on whitespace.</span></div>
<div class="line"><a name="l00458"></a><span class="lineno">  458</span>&#160;  <span class="keyword">template</span> &lt;<span class="keyword">typename</span> U = T,</div>
<div class="line"><a name="l00459"></a><span class="lineno">  459</span>&#160;            <span class="keyword">typename</span> S,</div>
<div class="line"><a name="l00460"></a><span class="lineno">  460</span>&#160;            <span class="keyword">typename</span> std::enable_if_t&lt;std::is_same&lt;U, S&gt;::value, <span class="keywordtype">int</span>&gt; = 0&gt;</div>
<div class="line"><a name="l00461"></a><span class="lineno">  461</span>&#160;  <span class="keywordtype">bool</span> do_process(<span class="keyword">const</span> S&amp; s)</div>
<div class="line"><a name="l00462"></a><span class="lineno">  462</span>&#160;  {</div>
<div class="line"><a name="l00463"></a><span class="lineno">  463</span>&#160;    *value = s;</div>
<div class="line"><a name="l00464"></a><span class="lineno">  464</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00465"></a><span class="lineno">  465</span>&#160;  }</div>
<div class="line"><a name="l00466"></a><span class="lineno">  466</span>&#160; </div>
<div class="line"><a name="l00467"></a><span class="lineno">  467</span>&#160;  <span class="comment">// For non-string types, at the mercy of stringstream.</span></div>
<div class="line"><a name="l00468"></a><span class="lineno">  468</span>&#160;  <span class="keyword">template</span> &lt;<span class="keyword">typename</span> U = T,</div>
<div class="line"><a name="l00469"></a><span class="lineno">  469</span>&#160;            <span class="keyword">typename</span> S,</div>
<div class="line"><a name="l00470"></a><span class="lineno">  470</span>&#160;            <span class="keyword">typename</span> std::enable_if_t&lt;!std::is_same&lt;U, S&gt;::value, <span class="keywordtype">int</span>&gt; = 0&gt;</div>
<div class="line"><a name="l00471"></a><span class="lineno">  471</span>&#160;  <span class="keywordtype">bool</span> do_process(<span class="keyword">const</span> S&amp; s)</div>
<div class="line"><a name="l00472"></a><span class="lineno">  472</span>&#160;  {</div>
<div class="line"><a name="l00473"></a><span class="lineno">  473</span>&#160;    std::istringstream iss(s);</div>
<div class="line"><a name="l00474"></a><span class="lineno">  474</span>&#160;    <span class="keywordflow">return</span> bool(iss &gt;&gt; *value);</div>
<div class="line"><a name="l00475"></a><span class="lineno">  475</span>&#160;  }</div>
<div class="line"><a name="l00476"></a><span class="lineno">  476</span>&#160; </div>
<div class="line"><a name="l00477"></a><span class="lineno">  477</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00478"></a><span class="lineno">  478</span>&#160;  ArgType getArgType()<span class="keyword"> override </span>{ <span class="keywordflow">return</span> arg_type; }</div>
<div class="line"><a name="l00479"></a><span class="lineno">  479</span>&#160; </div>
<div class="line"><a name="l00480"></a><span class="lineno">  480</span>&#160;  <span class="keywordtype">bool</span> process(<span class="keyword">const</span> std::string&amp; s)<span class="keyword"> override </span>{ <span class="keywordflow">return</span> this-&gt;do_process(s); }</div>
<div class="line"><a name="l00481"></a><span class="lineno">  481</span>&#160; </div>
<div class="line"><a name="l00482"></a><span class="lineno">  482</span>&#160;  <span class="keyword">explicit</span> ArgProcessorValue(T* v, ArgType at) : value(v), arg_type(at) {}</div>
<div class="line"><a name="l00483"></a><span class="lineno">  483</span>&#160;}; <span class="comment">// end of ArgProcessorValue</span></div>
<div class="line"><a name="l00484"></a><span class="lineno">  484</span>&#160; </div>
<div class="line"><a name="l00485"></a><span class="lineno">  485</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00486"></a><span class="lineno"><a class="line" href="classhelib_1_1_arg_map.html#a72a8c34a4d72036f02d3bb3cc6f754d2">  486</a></span>&#160;<a class="code" href="classhelib_1_1_arg_map.html">ArgMap</a>&amp; <a class="code" href="classhelib_1_1_arg_map.html#a72a8c34a4d72036f02d3bb3cc6f754d2">ArgMap::arg</a>(<span class="keyword">const</span> std::string&amp; name, T&amp; value)</div>
<div class="line"><a name="l00487"></a><span class="lineno">  487</span>&#160;{</div>
<div class="line"><a name="l00488"></a><span class="lineno">  488</span>&#160;  <span class="comment">// trying to add empty or whitespace name?</span></div>
<div class="line"><a name="l00489"></a><span class="lineno">  489</span>&#160;  assertTrue&lt;LogicError&gt;(</div>
<div class="line"><a name="l00490"></a><span class="lineno">  490</span>&#160;      !name.empty() &amp;&amp;</div>
<div class="line"><a name="l00491"></a><span class="lineno">  491</span>&#160;          std::none_of(name.begin(),</div>
<div class="line"><a name="l00492"></a><span class="lineno">  492</span>&#160;                       name.end(),</div>
<div class="line"><a name="l00493"></a><span class="lineno">  493</span>&#160;                       [](<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> c) { return std::isspace(c); }),</div>
<div class="line"><a name="l00494"></a><span class="lineno">  494</span>&#160;      <span class="stringliteral">&quot;Attempting to register an empty string or string with whitespace&quot;</span>);</div>
<div class="line"><a name="l00495"></a><span class="lineno">  495</span>&#160; </div>
<div class="line"><a name="l00496"></a><span class="lineno">  496</span>&#160;  <span class="comment">// has this name already been added?</span></div>
<div class="line"><a name="l00497"></a><span class="lineno">  497</span>&#160;  assertTrue&lt;LogicError&gt;(map.count(name) == 0,</div>
<div class="line"><a name="l00498"></a><span class="lineno">  498</span>&#160;                         <span class="stringliteral">&quot;Key already in arg map (key: &quot;</span> + name + <span class="stringliteral">&quot;)&quot;</span>);</div>
<div class="line"><a name="l00499"></a><span class="lineno">  499</span>&#160; </div>
<div class="line"><a name="l00500"></a><span class="lineno">  500</span>&#160;  <span class="comment">// have we seen this addr before?</span></div>
<div class="line"><a name="l00501"></a><span class="lineno">  501</span>&#160;  assertEq&lt;LogicError&gt;(addresses_used.count(&amp;value),</div>
<div class="line"><a name="l00502"></a><span class="lineno">  502</span>&#160;                       0ul,</div>
<div class="line"><a name="l00503"></a><span class="lineno">  503</span>&#160;                       <span class="stringliteral">&quot;Attempting to register variable twice&quot;</span>);</div>
<div class="line"><a name="l00504"></a><span class="lineno">  504</span>&#160; </div>
<div class="line"><a name="l00505"></a><span class="lineno">  505</span>&#160;  addresses_used.insert(&amp;value);</div>
<div class="line"><a name="l00506"></a><span class="lineno">  506</span>&#160; </div>
<div class="line"><a name="l00507"></a><span class="lineno">  507</span>&#160;  map[name] = std::make_shared&lt;ArgProcessorValue&lt;T&gt;&gt;(&amp;value, this-&gt;arg_type);</div>
<div class="line"><a name="l00508"></a><span class="lineno">  508</span>&#160; </div>
<div class="line"><a name="l00509"></a><span class="lineno">  509</span>&#160;  <span class="keywordflow">if</span> (this-&gt;arg_type == ArgType::POSITIONAL) {</div>
<div class="line"><a name="l00510"></a><span class="lineno">  510</span>&#160;    this-&gt;positional_args_list.insert(name, !this-&gt;required_mode);</div>
<div class="line"><a name="l00511"></a><span class="lineno">  511</span>&#160;  }</div>
<div class="line"><a name="l00512"></a><span class="lineno">  512</span>&#160; </div>
<div class="line"><a name="l00513"></a><span class="lineno">  513</span>&#160;  <span class="keywordflow">if</span> (this-&gt;required_mode) {</div>
<div class="line"><a name="l00514"></a><span class="lineno">  514</span>&#160;    <span class="comment">// The user should make toggles correct in the code with optional</span></div>
<div class="line"><a name="l00515"></a><span class="lineno">  515</span>&#160;    <span class="keywordflow">if</span> (this-&gt;arg_type == ArgType::TOGGLE_TRUE ||</div>
<div class="line"><a name="l00516"></a><span class="lineno">  516</span>&#160;        this-&gt;arg_type == ArgType::TOGGLE_FALSE)</div>
<div class="line"><a name="l00517"></a><span class="lineno">  517</span>&#160;      <span class="keywordflow">throw</span> <a class="code" href="classhelib_1_1_logic_error.html">LogicError</a>(<span class="stringliteral">&quot;Toggle argument types cannot be required.&quot;</span>);</div>
<div class="line"><a name="l00518"></a><span class="lineno">  518</span>&#160;    this-&gt;required_set.insert(name);</div>
<div class="line"><a name="l00519"></a><span class="lineno">  519</span>&#160;  } <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00520"></a><span class="lineno">  520</span>&#160;    <span class="comment">// It is optional</span></div>
<div class="line"><a name="l00521"></a><span class="lineno">  521</span>&#160;    this-&gt;optional_set.insert(name);</div>
<div class="line"><a name="l00522"></a><span class="lineno">  522</span>&#160;  }</div>
<div class="line"><a name="l00523"></a><span class="lineno">  523</span>&#160; </div>
<div class="line"><a name="l00524"></a><span class="lineno">  524</span>&#160;  <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
<div class="line"><a name="l00525"></a><span class="lineno">  525</span>&#160;}</div>
<div class="line"><a name="l00526"></a><span class="lineno">  526</span>&#160; </div>
<div class="line"><a name="l00527"></a><span class="lineno">  527</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00528"></a><span class="lineno"><a class="line" href="classhelib_1_1_arg_map.html#a42478737c5cde2588dd05507ba223c18">  528</a></span>&#160;<a class="code" href="classhelib_1_1_arg_map.html">ArgMap</a>&amp; <a class="code" href="classhelib_1_1_arg_map.html#a72a8c34a4d72036f02d3bb3cc6f754d2">ArgMap::arg</a>(<span class="keyword">const</span> std::string&amp; name, T&amp; value, <span class="keyword">const</span> std::string&amp; doc)</div>
<div class="line"><a name="l00529"></a><span class="lineno">  529</span>&#160;{</div>
<div class="line"><a name="l00530"></a><span class="lineno">  530</span>&#160;  <a class="code" href="classhelib_1_1_arg_map.html#a72a8c34a4d72036f02d3bb3cc6f754d2">arg</a>(name, value);</div>
<div class="line"><a name="l00531"></a><span class="lineno">  531</span>&#160;  std::stringstream ss;</div>
<div class="line"><a name="l00532"></a><span class="lineno">  532</span>&#160;  ss &lt;&lt; <a class="code" href="classhelib_1_1_arg_map.html#a7665dba84ba3a420e052a61eb6c4e30f">doc</a> &lt;&lt; <span class="stringliteral">&quot; [ default=&quot;</span> &lt;&lt; value &lt;&lt; <span class="stringliteral">&quot; ]&quot;</span>;</div>
<div class="line"><a name="l00533"></a><span class="lineno">  533</span>&#160;  docVec.push_back({name, ss.str(), required_mode});</div>
<div class="line"><a name="l00534"></a><span class="lineno">  534</span>&#160; </div>
<div class="line"><a name="l00535"></a><span class="lineno">  535</span>&#160;  <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
<div class="line"><a name="l00536"></a><span class="lineno">  536</span>&#160;}</div>
<div class="line"><a name="l00537"></a><span class="lineno">  537</span>&#160; </div>
<div class="line"><a name="l00538"></a><span class="lineno">  538</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00539"></a><span class="lineno"><a class="line" href="classhelib_1_1_arg_map.html#a41267f47c1fcd1b8d7ba4d0a38fc0f47">  539</a></span>&#160;<a class="code" href="classhelib_1_1_arg_map.html">ArgMap</a>&amp; <a class="code" href="classhelib_1_1_arg_map.html#a72a8c34a4d72036f02d3bb3cc6f754d2">ArgMap::arg</a>(<span class="keyword">const</span> std::string&amp; name,</div>
<div class="line"><a name="l00540"></a><span class="lineno">  540</span>&#160;                    T&amp; value,</div>
<div class="line"><a name="l00541"></a><span class="lineno">  541</span>&#160;                    <span class="keyword">const</span> std::string&amp; doc,</div>
<div class="line"><a name="l00542"></a><span class="lineno">  542</span>&#160;                    <span class="keyword">const</span> <span class="keywordtype">char</span>* info)</div>
<div class="line"><a name="l00543"></a><span class="lineno">  543</span>&#160;{</div>
<div class="line"><a name="l00544"></a><span class="lineno">  544</span>&#160;  <a class="code" href="classhelib_1_1_arg_map.html#a72a8c34a4d72036f02d3bb3cc6f754d2">arg</a>(name, value);</div>
<div class="line"><a name="l00545"></a><span class="lineno">  545</span>&#160; </div>
<div class="line"><a name="l00546"></a><span class="lineno">  546</span>&#160;  docVec.push_back({name, <a class="code" href="classhelib_1_1_arg_map.html#a7665dba84ba3a420e052a61eb6c4e30f">doc</a>, required_mode});</div>
<div class="line"><a name="l00547"></a><span class="lineno">  547</span>&#160;  <span class="keywordflow">if</span> (info != <span class="keyword">nullptr</span> &amp;&amp; info[0] != <span class="charliteral">&#39;\0&#39;</span>)</div>
<div class="line"><a name="l00548"></a><span class="lineno">  548</span>&#160;    std::get&lt;1&gt;(docVec.back()).append(<span class="stringliteral">&quot; [ default=&quot;</span>).append(info).append(<span class="stringliteral">&quot; ]&quot;</span>);</div>
<div class="line"><a name="l00549"></a><span class="lineno">  549</span>&#160; </div>
<div class="line"><a name="l00550"></a><span class="lineno">  550</span>&#160;  <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
<div class="line"><a name="l00551"></a><span class="lineno">  551</span>&#160;}</div>
<div class="line"><a name="l00552"></a><span class="lineno">  552</span>&#160; </div>
<div class="line"><a name="l00553"></a><span class="lineno">  553</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> C&gt;</div>
<div class="line"><a name="l00554"></a><span class="lineno"><a class="line" href="classhelib_1_1_arg_map.html#a8e2a662a2283329301f6d7b5e0e845c8">  554</a></span>&#160;<a class="code" href="classhelib_1_1_arg_map.html">ArgMap</a>&amp; <a class="code" href="classhelib_1_1_arg_map.html#a8e2a662a2283329301f6d7b5e0e845c8">ArgMap::dots</a>(C&amp; container, <span class="keyword">const</span> <span class="keywordtype">char</span>* name)</div>
<div class="line"><a name="l00555"></a><span class="lineno">  555</span>&#160;{</div>
<div class="line"><a name="l00556"></a><span class="lineno">  556</span>&#160;  <span class="keywordflow">if</span> (this-&gt;dots_enabled)</div>
<div class="line"><a name="l00557"></a><span class="lineno">  557</span>&#160;    <span class="keywordflow">throw</span> <a class="code" href="classhelib_1_1_logic_error.html">LogicError</a>(<span class="stringliteral">&quot;.dots() can only be called once.&quot;</span>);</div>
<div class="line"><a name="l00558"></a><span class="lineno">  558</span>&#160; </div>
<div class="line"><a name="l00559"></a><span class="lineno">  559</span>&#160;  this-&gt;dots_enabled = <span class="keyword">true</span>;</div>
<div class="line"><a name="l00560"></a><span class="lineno">  560</span>&#160;  this-&gt;dots_name = name;</div>
<div class="line"><a name="l00561"></a><span class="lineno">  561</span>&#160; </div>
<div class="line"><a name="l00562"></a><span class="lineno">  562</span>&#160;  <span class="comment">// Have it out of the map as it may be called many times and has no</span></div>
<div class="line"><a name="l00563"></a><span class="lineno">  563</span>&#160;  <span class="comment">// name/token.</span></div>
<div class="line"><a name="l00564"></a><span class="lineno">  564</span>&#160;  this-&gt;dots_ap = std::make_unique&lt;ArgProcessorContainer&lt;C&gt;&gt;(&amp;container);</div>
<div class="line"><a name="l00565"></a><span class="lineno">  565</span>&#160; </div>
<div class="line"><a name="l00566"></a><span class="lineno">  566</span>&#160;  <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
<div class="line"><a name="l00567"></a><span class="lineno">  567</span>&#160;}</div>
<div class="line"><a name="l00568"></a><span class="lineno">  568</span>&#160; </div>
<div class="line"><a name="l00569"></a><span class="lineno"><a class="line" href="classhelib_1_1_arg_map.html#a7bcbfcccc0c9fcc9f3eba06067fcd97f">  569</a></span>&#160;<span class="keyword">inline</span> <a class="code" href="classhelib_1_1_arg_map.html">ArgMap</a>&amp; <a class="code" href="classhelib_1_1_arg_map.html#a7bcbfcccc0c9fcc9f3eba06067fcd97f">ArgMap::note</a>(<span class="keyword">const</span> std::string&amp; s)</div>
<div class="line"><a name="l00570"></a><span class="lineno">  570</span>&#160;{</div>
<div class="line"><a name="l00571"></a><span class="lineno">  571</span>&#160;  std::get&lt;1&gt;(docVec.back()).append(<span class="stringliteral">&quot;\t\t&quot;</span>).append(s);</div>
<div class="line"><a name="l00572"></a><span class="lineno">  572</span>&#160;  <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
<div class="line"><a name="l00573"></a><span class="lineno">  573</span>&#160;}</div>
<div class="line"><a name="l00574"></a><span class="lineno">  574</span>&#160; </div>
<div class="line"><a name="l00575"></a><span class="lineno"><a class="line" href="classhelib_1_1_arg_map.html#a383d5eb53291ab618eebeb60c2112dde">  575</a></span>&#160;<span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_arg_map.html#a383d5eb53291ab618eebeb60c2112dde">ArgMap::usage</a>(<span class="keyword">const</span> std::string&amp; msg)<span class="keyword"> const</span></div>
<div class="line"><a name="l00576"></a><span class="lineno">  576</span>&#160;<span class="keyword"></span>{</div>
<div class="line"><a name="l00577"></a><span class="lineno">  577</span>&#160;  <span class="keywordflow">if</span> (!msg.empty())</div>
<div class="line"><a name="l00578"></a><span class="lineno">  578</span>&#160;    std::cerr &lt;&lt; msg &lt;&lt; <span class="charliteral">&#39;\n&#39;</span>;</div>
<div class="line"><a name="l00579"></a><span class="lineno">  579</span>&#160; </div>
<div class="line"><a name="l00580"></a><span class="lineno">  580</span>&#160;  decltype(docVec) docVecCopy = docVec;</div>
<div class="line"><a name="l00581"></a><span class="lineno">  581</span>&#160;  std::stable_partition(</div>
<div class="line"><a name="l00582"></a><span class="lineno">  582</span>&#160;      docVecCopy.begin(),</div>
<div class="line"><a name="l00583"></a><span class="lineno">  583</span>&#160;      docVecCopy.end(),</div>
<div class="line"><a name="l00584"></a><span class="lineno">  584</span>&#160;      [<span class="keyword">this</span>](<span class="keyword">const</span> <span class="keyword">auto</span>&amp; item) {</div>
<div class="line"><a name="l00585"></a><span class="lineno">  585</span>&#160;        const auto&amp; it = map.find(std::get&lt;0&gt;(item));</div>
<div class="line"><a name="l00586"></a><span class="lineno">  586</span>&#160;        if (it == map.end())</div>
<div class="line"><a name="l00587"></a><span class="lineno">  587</span>&#160;          throw LogicError(<span class="stringliteral">&quot;Not found in map &#39;&quot;</span> + std::get&lt;0&gt;(item) + <span class="stringliteral">&quot;&#39;.&quot;</span>);</div>
<div class="line"><a name="l00588"></a><span class="lineno">  588</span>&#160;        else</div>
<div class="line"><a name="l00589"></a><span class="lineno">  589</span>&#160;          return it-&gt;second-&gt;getArgType() != ArgType::POSITIONAL;</div>
<div class="line"><a name="l00590"></a><span class="lineno">  590</span>&#160;      });</div>
<div class="line"><a name="l00591"></a><span class="lineno">  591</span>&#160; </div>
<div class="line"><a name="l00592"></a><span class="lineno">  592</span>&#160;  std::cerr &lt;&lt; <span class="stringliteral">&quot;Usage: &quot;</span> &lt;&lt; this-&gt;progname;</div>
<div class="line"><a name="l00593"></a><span class="lineno">  593</span>&#160;  <span class="keywordflow">for</span> (<span class="keyword">const</span> <span class="keyword">auto</span>&amp; <a class="code" href="classhelib_1_1_arg_map.html#a7665dba84ba3a420e052a61eb6c4e30f">doc</a> : docVecCopy) {</div>
<div class="line"><a name="l00594"></a><span class="lineno">  594</span>&#160;    std::string name_ext(std::get&lt;0&gt;(<a class="code" href="classhelib_1_1_arg_map.html#a7665dba84ba3a420e052a61eb6c4e30f">doc</a>));</div>
<div class="line"><a name="l00595"></a><span class="lineno">  595</span>&#160;    <span class="keyword">auto</span> it = map.find(name_ext);</div>
<div class="line"><a name="l00596"></a><span class="lineno">  596</span>&#160;    <span class="keywordflow">if</span> (it == map.end())</div>
<div class="line"><a name="l00597"></a><span class="lineno">  597</span>&#160;      <span class="keywordflow">throw</span> <a class="code" href="classhelib_1_1_logic_error.html">LogicError</a>(<span class="stringliteral">&quot;Not found in map &#39;&quot;</span> + name_ext + <span class="stringliteral">&quot;&#39;.&quot;</span>);</div>
<div class="line"><a name="l00598"></a><span class="lineno">  598</span>&#160;    <span class="keywordflow">if</span> (it-&gt;second-&gt;getArgType() == ArgType::NAMED)</div>
<div class="line"><a name="l00599"></a><span class="lineno">  599</span>&#160;      name_ext.append(1, this-&gt;kv_separator).append(<span class="stringliteral">&quot;&lt;arg&gt;&quot;</span>);</div>
<div class="line"><a name="l00600"></a><span class="lineno">  600</span>&#160;    <span class="keywordflow">if</span> (std::get&lt;2&gt;(<a class="code" href="classhelib_1_1_arg_map.html#a7665dba84ba3a420e052a61eb6c4e30f">doc</a>)) {</div>
<div class="line"><a name="l00601"></a><span class="lineno">  601</span>&#160;      std::cerr &lt;&lt; <span class="stringliteral">&quot; &quot;</span> &lt;&lt; name_ext;</div>
<div class="line"><a name="l00602"></a><span class="lineno">  602</span>&#160;    } <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00603"></a><span class="lineno">  603</span>&#160;      std::cerr &lt;&lt; <span class="stringliteral">&quot; [&quot;</span> &lt;&lt; name_ext &lt;&lt; <span class="stringliteral">&quot;]&quot;</span>;</div>
<div class="line"><a name="l00604"></a><span class="lineno">  604</span>&#160;    }</div>
<div class="line"><a name="l00605"></a><span class="lineno">  605</span>&#160;  }</div>
<div class="line"><a name="l00606"></a><span class="lineno">  606</span>&#160; </div>
<div class="line"><a name="l00607"></a><span class="lineno">  607</span>&#160;  <span class="keywordflow">if</span> (this-&gt;dots_enabled)</div>
<div class="line"><a name="l00608"></a><span class="lineno">  608</span>&#160;    std::cerr &lt;&lt; <span class="stringliteral">&quot; [&quot;</span> &lt;&lt; this-&gt;dots_name &lt;&lt; <span class="stringliteral">&quot; ...]\n&quot;</span>;</div>
<div class="line"><a name="l00609"></a><span class="lineno">  609</span>&#160;  <span class="keywordflow">else</span></div>
<div class="line"><a name="l00610"></a><span class="lineno">  610</span>&#160;    std::cerr &lt;&lt; <span class="stringliteral">&quot;\n&quot;</span>;</div>
<div class="line"><a name="l00611"></a><span class="lineno">  611</span>&#160; </div>
<div class="line"><a name="l00612"></a><span class="lineno">  612</span>&#160;  std::cerr &lt;&lt; <a class="code" href="classhelib_1_1_arg_map.html#a7665dba84ba3a420e052a61eb6c4e30f">doc</a>() &lt;&lt; std::endl;</div>
<div class="line"><a name="l00613"></a><span class="lineno">  613</span>&#160; </div>
<div class="line"><a name="l00614"></a><span class="lineno">  614</span>&#160;  exit(EXIT_FAILURE);</div>
<div class="line"><a name="l00615"></a><span class="lineno">  615</span>&#160;}</div>
<div class="line"><a name="l00616"></a><span class="lineno">  616</span>&#160; </div>
<div class="line"><a name="l00617"></a><span class="lineno"><a class="line" href="classhelib_1_1_arg_map.html#a0ecab734381e89bf13e2dd38af25585c">  617</a></span>&#160;<span class="keyword">inline</span> <a class="code" href="classhelib_1_1_arg_map.html">ArgMap</a>&amp; <a class="code" href="classhelib_1_1_arg_map.html#a0ecab734381e89bf13e2dd38af25585c">ArgMap::helpArgs</a>(<span class="keyword">const</span> std::initializer_list&lt;std::string&gt; s)</div>
<div class="line"><a name="l00618"></a><span class="lineno">  618</span>&#160;{</div>
<div class="line"><a name="l00619"></a><span class="lineno">  619</span>&#160;  this-&gt;help_tokens = s;</div>
<div class="line"><a name="l00620"></a><span class="lineno">  620</span>&#160;  <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
<div class="line"><a name="l00621"></a><span class="lineno">  621</span>&#160;}</div>
<div class="line"><a name="l00622"></a><span class="lineno">  622</span>&#160; </div>
<div class="line"><a name="l00623"></a><span class="lineno"><a class="line" href="classhelib_1_1_arg_map.html#aec9f54ce4e5c048da7d35c2a23688a75">  623</a></span>&#160;<span class="keyword">inline</span> <a class="code" href="classhelib_1_1_arg_map.html">ArgMap</a>&amp; <a class="code" href="classhelib_1_1_arg_map.html#a0ecab734381e89bf13e2dd38af25585c">ArgMap::helpArgs</a>(<span class="keyword">const</span> std::string s)</div>
<div class="line"><a name="l00624"></a><span class="lineno">  624</span>&#160;{</div>
<div class="line"><a name="l00625"></a><span class="lineno">  625</span>&#160;  this-&gt;help_tokens = {s};</div>
<div class="line"><a name="l00626"></a><span class="lineno">  626</span>&#160;  <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
<div class="line"><a name="l00627"></a><span class="lineno">  627</span>&#160;}</div>
<div class="line"><a name="l00628"></a><span class="lineno">  628</span>&#160; </div>
<div class="line"><a name="l00629"></a><span class="lineno"><a class="line" href="classhelib_1_1_arg_map.html#ae477d3e97e6b9f4e847b7976fc939992">  629</a></span>&#160;<span class="keyword">inline</span> <a class="code" href="classhelib_1_1_arg_map.html">ArgMap</a>&amp; <a class="code" href="classhelib_1_1_arg_map.html#ae477d3e97e6b9f4e847b7976fc939992">ArgMap::separator</a>(<a class="code" href="classhelib_1_1_arg_map.html#ac96d090b5476e9a39b41ae27d74641b0">Separator</a> s)</div>
<div class="line"><a name="l00630"></a><span class="lineno">  630</span>&#160;{</div>
<div class="line"><a name="l00631"></a><span class="lineno">  631</span>&#160;  <span class="keywordflow">switch</span> (s) {</div>
<div class="line"><a name="l00632"></a><span class="lineno">  632</span>&#160;  <span class="keywordflow">case</span> <a class="code" href="classhelib_1_1_arg_map.html#ac96d090b5476e9a39b41ae27d74641b0a6837aeca94b8f55801166eb031e26a5a">Separator::EQUALS</a>:</div>
<div class="line"><a name="l00633"></a><span class="lineno">  633</span>&#160;    this-&gt;kv_separator = <span class="charliteral">&#39;=&#39;</span>;</div>
<div class="line"><a name="l00634"></a><span class="lineno">  634</span>&#160;    <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00635"></a><span class="lineno">  635</span>&#160;  <span class="keywordflow">case</span> <a class="code" href="classhelib_1_1_arg_map.html#ac96d090b5476e9a39b41ae27d74641b0af65f22e75defc168edfc6444e6aaf4f8">Separator::COLON</a>:</div>
<div class="line"><a name="l00636"></a><span class="lineno">  636</span>&#160;    this-&gt;kv_separator = <span class="charliteral">&#39;:&#39;</span>;</div>
<div class="line"><a name="l00637"></a><span class="lineno">  637</span>&#160;    <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00638"></a><span class="lineno">  638</span>&#160;  <span class="keywordflow">case</span> <a class="code" href="classhelib_1_1_arg_map.html#ac96d090b5476e9a39b41ae27d74641b0a52f1e315372b38db1b8f4e3666c4f721">Separator::WHITESPACE</a>:</div>
<div class="line"><a name="l00639"></a><span class="lineno">  639</span>&#160;    this-&gt;kv_separator = <span class="charliteral">&#39; &#39;</span>;</div>
<div class="line"><a name="l00640"></a><span class="lineno">  640</span>&#160;    <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00641"></a><span class="lineno">  641</span>&#160;  <span class="keywordflow">default</span>:</div>
<div class="line"><a name="l00642"></a><span class="lineno">  642</span>&#160;    <span class="comment">// Use of class enums means it should never reach here.</span></div>
<div class="line"><a name="l00643"></a><span class="lineno">  643</span>&#160;    <span class="keywordflow">throw</span> <a class="code" href="classhelib_1_1_logic_error.html">LogicError</a>(<span class="stringliteral">&quot;Unrecognised option for kv separator.&quot;</span>);</div>
<div class="line"><a name="l00644"></a><span class="lineno">  644</span>&#160;  }</div>
<div class="line"><a name="l00645"></a><span class="lineno">  645</span>&#160; </div>
<div class="line"><a name="l00646"></a><span class="lineno">  646</span>&#160;  <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
<div class="line"><a name="l00647"></a><span class="lineno">  647</span>&#160;}</div>
<div class="line"><a name="l00648"></a><span class="lineno">  648</span>&#160; </div>
<div class="line"><a name="l00649"></a><span class="lineno"><a class="line" href="classhelib_1_1_arg_map.html#a39ddbc25b7e1b038dbab65d5c1383b50">  649</a></span>&#160;<span class="keyword">inline</span> <a class="code" href="classhelib_1_1_arg_map.html">ArgMap</a>&amp; <a class="code" href="classhelib_1_1_arg_map.html#a39ddbc25b7e1b038dbab65d5c1383b50">ArgMap::optional</a>()</div>
<div class="line"><a name="l00650"></a><span class="lineno">  650</span>&#160;{</div>
<div class="line"><a name="l00651"></a><span class="lineno">  651</span>&#160;  this-&gt;required_mode = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00652"></a><span class="lineno">  652</span>&#160;  <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
<div class="line"><a name="l00653"></a><span class="lineno">  653</span>&#160;}</div>
<div class="line"><a name="l00654"></a><span class="lineno">  654</span>&#160; </div>
<div class="line"><a name="l00655"></a><span class="lineno"><a class="line" href="classhelib_1_1_arg_map.html#aa7dcd50df0466cd4be10a94eb3f96d1b">  655</a></span>&#160;<span class="keyword">inline</span> <a class="code" href="classhelib_1_1_arg_map.html">ArgMap</a>&amp; <a class="code" href="classhelib_1_1_arg_map.html#aa7dcd50df0466cd4be10a94eb3f96d1b">ArgMap::required</a>()</div>
<div class="line"><a name="l00656"></a><span class="lineno">  656</span>&#160;{</div>
<div class="line"><a name="l00657"></a><span class="lineno">  657</span>&#160;  this-&gt;required_mode = <span class="keyword">true</span>;</div>
<div class="line"><a name="l00658"></a><span class="lineno">  658</span>&#160;  <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
<div class="line"><a name="l00659"></a><span class="lineno">  659</span>&#160;}</div>
<div class="line"><a name="l00660"></a><span class="lineno">  660</span>&#160; </div>
<div class="line"><a name="l00661"></a><span class="lineno"><a class="line" href="classhelib_1_1_arg_map.html#af838c44fcb91c73284de3cbf993861f2">  661</a></span>&#160;<span class="keyword">inline</span> <a class="code" href="classhelib_1_1_arg_map.html">ArgMap</a>&amp; <a class="code" href="classhelib_1_1_arg_map.html#af838c44fcb91c73284de3cbf993861f2">ArgMap::toggle</a>(<span class="keywordtype">bool</span> t)</div>
<div class="line"><a name="l00662"></a><span class="lineno">  662</span>&#160;{</div>
<div class="line"><a name="l00663"></a><span class="lineno">  663</span>&#160;  this-&gt;named_args_only = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00664"></a><span class="lineno">  664</span>&#160;  this-&gt;arg_type = t ? ArgType::TOGGLE_TRUE : ArgType::TOGGLE_FALSE;</div>
<div class="line"><a name="l00665"></a><span class="lineno">  665</span>&#160;  <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
<div class="line"><a name="l00666"></a><span class="lineno">  666</span>&#160;}</div>
<div class="line"><a name="l00667"></a><span class="lineno">  667</span>&#160; </div>
<div class="line"><a name="l00668"></a><span class="lineno"><a class="line" href="classhelib_1_1_arg_map.html#ac06dd5e3726ecd5d8e688d665c2c9e50">  668</a></span>&#160;<span class="keyword">inline</span> <a class="code" href="classhelib_1_1_arg_map.html">ArgMap</a>&amp; <a class="code" href="classhelib_1_1_arg_map.html#ac06dd5e3726ecd5d8e688d665c2c9e50">ArgMap::named</a>()</div>
<div class="line"><a name="l00669"></a><span class="lineno">  669</span>&#160;{</div>
<div class="line"><a name="l00670"></a><span class="lineno">  670</span>&#160;  this-&gt;arg_type = ArgType::NAMED;</div>
<div class="line"><a name="l00671"></a><span class="lineno">  671</span>&#160;  <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
<div class="line"><a name="l00672"></a><span class="lineno">  672</span>&#160;}</div>
<div class="line"><a name="l00673"></a><span class="lineno">  673</span>&#160; </div>
<div class="line"><a name="l00674"></a><span class="lineno"><a class="line" href="classhelib_1_1_arg_map.html#adf55e7e52a63bd72fe212cb90e58ad64">  674</a></span>&#160;<span class="keyword">inline</span> <a class="code" href="classhelib_1_1_arg_map.html">ArgMap</a>&amp; <a class="code" href="classhelib_1_1_arg_map.html#adf55e7e52a63bd72fe212cb90e58ad64">ArgMap::positional</a>()</div>
<div class="line"><a name="l00675"></a><span class="lineno">  675</span>&#160;{</div>
<div class="line"><a name="l00676"></a><span class="lineno">  676</span>&#160;  this-&gt;named_args_only = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00677"></a><span class="lineno">  677</span>&#160;  this-&gt;arg_type = ArgType::POSITIONAL;</div>
<div class="line"><a name="l00678"></a><span class="lineno">  678</span>&#160;  <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
<div class="line"><a name="l00679"></a><span class="lineno">  679</span>&#160;}</div>
<div class="line"><a name="l00680"></a><span class="lineno">  680</span>&#160; </div>
<div class="line"><a name="l00681"></a><span class="lineno"><a class="line" href="classhelib_1_1_arg_map.html#af54e2d261ed329d3b3b2e2cfbf35ab80">  681</a></span>&#160;<span class="keyword">inline</span> <a class="code" href="classhelib_1_1_arg_map.html">ArgMap</a>&amp; <a class="code" href="classhelib_1_1_arg_map.html#af54e2d261ed329d3b3b2e2cfbf35ab80">ArgMap::diagnostics</a>(std::ostream&amp; ostrm)</div>
<div class="line"><a name="l00682"></a><span class="lineno">  682</span>&#160;{</div>
<div class="line"><a name="l00683"></a><span class="lineno">  683</span>&#160;  this-&gt;diagnostics_strm = &amp;ostrm;</div>
<div class="line"><a name="l00684"></a><span class="lineno">  684</span>&#160;  <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
<div class="line"><a name="l00685"></a><span class="lineno">  685</span>&#160;}</div>
<div class="line"><a name="l00686"></a><span class="lineno">  686</span>&#160; </div>
<div class="line"><a name="l00687"></a><span class="lineno">  687</span>&#160;<span class="keyword">inline</span> <span class="keywordtype">void</span> ArgMap::printDiagnostics(</div>
<div class="line"><a name="l00688"></a><span class="lineno">  688</span>&#160;    <span class="keyword">const</span> std::forward_list&lt;std::string&gt;&amp; args)<span class="keyword"> const</span></div>
<div class="line"><a name="l00689"></a><span class="lineno">  689</span>&#160;<span class="keyword"></span>{</div>
<div class="line"><a name="l00690"></a><span class="lineno">  690</span>&#160;  <span class="keywordflow">if</span> (this-&gt;diagnostics_strm != <span class="keyword">nullptr</span>) {</div>
<div class="line"><a name="l00691"></a><span class="lineno">  691</span>&#160;    <span class="comment">// argv as seen by ArgMap</span></div>
<div class="line"><a name="l00692"></a><span class="lineno">  692</span>&#160;    *this-&gt;diagnostics_strm &lt;&lt; <span class="stringliteral">&quot;Args pre-parse:\n&quot;</span>;</div>
<div class="line"><a name="l00693"></a><span class="lineno">  693</span>&#160;    <span class="keywordflow">for</span> (<span class="keyword">const</span> <span class="keyword">auto</span>&amp; e : args) {</div>
<div class="line"><a name="l00694"></a><span class="lineno">  694</span>&#160;      *this-&gt;diagnostics_strm &lt;&lt; e &lt;&lt; std::endl;</div>
<div class="line"><a name="l00695"></a><span class="lineno">  695</span>&#160;    }</div>
<div class="line"><a name="l00696"></a><span class="lineno">  696</span>&#160;    <span class="comment">// required set</span></div>
<div class="line"><a name="l00697"></a><span class="lineno">  697</span>&#160;    *this-&gt;diagnostics_strm &lt;&lt; <span class="stringliteral">&quot;Required args set:\n&quot;</span>;</div>
<div class="line"><a name="l00698"></a><span class="lineno">  698</span>&#160;    <span class="keywordflow">for</span> (<span class="keyword">const</span> <span class="keyword">auto</span>&amp; e : required_set) {</div>
<div class="line"><a name="l00699"></a><span class="lineno">  699</span>&#160;      *this-&gt;diagnostics_strm &lt;&lt; e &lt;&lt; std::endl;</div>
<div class="line"><a name="l00700"></a><span class="lineno">  700</span>&#160;    }</div>
<div class="line"><a name="l00701"></a><span class="lineno">  701</span>&#160;    <span class="comment">// optional set</span></div>
<div class="line"><a name="l00702"></a><span class="lineno">  702</span>&#160;    *this-&gt;diagnostics_strm &lt;&lt; <span class="stringliteral">&quot;Optional args set:\n&quot;</span>;</div>
<div class="line"><a name="l00703"></a><span class="lineno">  703</span>&#160;    <span class="keywordflow">for</span> (<span class="keyword">const</span> <span class="keyword">auto</span>&amp; e : optional_set) {</div>
<div class="line"><a name="l00704"></a><span class="lineno">  704</span>&#160;      *this-&gt;diagnostics_strm &lt;&lt; e &lt;&lt; std::endl;</div>
<div class="line"><a name="l00705"></a><span class="lineno">  705</span>&#160;    }</div>
<div class="line"><a name="l00706"></a><span class="lineno">  706</span>&#160;  }</div>
<div class="line"><a name="l00707"></a><span class="lineno">  707</span>&#160;}</div>
<div class="line"><a name="l00708"></a><span class="lineno">  708</span>&#160; </div>
<div class="line"><a name="l00709"></a><span class="lineno"><a class="line" href="classhelib_1_1_arg_map.html#a7665dba84ba3a420e052a61eb6c4e30f">  709</a></span>&#160;<span class="keyword">inline</span> std::string <a class="code" href="classhelib_1_1_arg_map.html#a7665dba84ba3a420e052a61eb6c4e30f">ArgMap::doc</a>()<span class="keyword"> const</span></div>
<div class="line"><a name="l00710"></a><span class="lineno">  710</span>&#160;<span class="keyword"></span>{</div>
<div class="line"><a name="l00711"></a><span class="lineno">  711</span>&#160;  std::stringstream ss;</div>
<div class="line"><a name="l00712"></a><span class="lineno">  712</span>&#160;  <span class="keyword">auto</span> maxSzElem =</div>
<div class="line"><a name="l00713"></a><span class="lineno">  713</span>&#160;      std::max_element(docVec.begin(),</div>
<div class="line"><a name="l00714"></a><span class="lineno">  714</span>&#160;                       docVec.end(),</div>
<div class="line"><a name="l00715"></a><span class="lineno">  715</span>&#160;                       [](<span class="keyword">const</span> <span class="keyword">auto</span>&amp; x, <span class="keyword">const</span> <span class="keyword">auto</span>&amp; y) {</div>
<div class="line"><a name="l00716"></a><span class="lineno">  716</span>&#160;                         return std::get&lt;0&gt;(x).size() &lt; std::get&lt;0&gt;(y).size();</div>
<div class="line"><a name="l00717"></a><span class="lineno">  717</span>&#160;                       });</div>
<div class="line"><a name="l00718"></a><span class="lineno">  718</span>&#160; </div>
<div class="line"><a name="l00719"></a><span class="lineno">  719</span>&#160;  <span class="keywordflow">for</span> (<span class="keyword">const</span> <span class="keyword">auto</span>&amp; p : docVec) {</div>
<div class="line"><a name="l00720"></a><span class="lineno">  720</span>&#160;    ss &lt;&lt; <span class="stringliteral">&quot;  &quot;</span> &lt;&lt; std::left &lt;&lt; std::setw(std::get&lt;0&gt;(*maxSzElem).length() + 1)</div>
<div class="line"><a name="l00721"></a><span class="lineno">  721</span>&#160;       &lt;&lt; std::get&lt;0&gt;(p) &lt;&lt; std::setw(0) &lt;&lt; std::get&lt;1&gt;(p) &lt;&lt; <span class="charliteral">&#39;\n&#39;</span>;</div>
<div class="line"><a name="l00722"></a><span class="lineno">  722</span>&#160;  }</div>
<div class="line"><a name="l00723"></a><span class="lineno">  723</span>&#160; </div>
<div class="line"><a name="l00724"></a><span class="lineno">  724</span>&#160;  <span class="keywordflow">return</span> ss.str();</div>
<div class="line"><a name="l00725"></a><span class="lineno">  725</span>&#160;}</div>
<div class="line"><a name="l00726"></a><span class="lineno">  726</span>&#160; </div>
<div class="line"><a name="l00727"></a><span class="lineno">  727</span>&#160;<span class="keyword">inline</span> <span class="keywordtype">void</span> ArgMap::simpleParse(<span class="keyword">const</span> std::forward_list&lt;std::string&gt;&amp; args,</div>
<div class="line"><a name="l00728"></a><span class="lineno">  728</span>&#160;                                <span class="keywordtype">bool</span> duplicates,</div>
<div class="line"><a name="l00729"></a><span class="lineno">  729</span>&#160;                                std::function&lt;<span class="keywordtype">void</span>(<span class="keyword">const</span> std::string&amp;)&gt; stop)</div>
<div class="line"><a name="l00730"></a><span class="lineno">  730</span>&#160;{</div>
<div class="line"><a name="l00731"></a><span class="lineno">  731</span>&#160;  <span class="keywordflow">if</span> (stop == <span class="keyword">nullptr</span>) {</div>
<div class="line"><a name="l00732"></a><span class="lineno">  732</span>&#160;    stop = std::bind(&amp;<a class="code" href="classhelib_1_1_arg_map.html#a383d5eb53291ab618eebeb60c2112dde">ArgMap::usage</a>, <span class="keyword">this</span>, std::placeholders::_1);</div>
<div class="line"><a name="l00733"></a><span class="lineno">  733</span>&#160;  }</div>
<div class="line"><a name="l00734"></a><span class="lineno">  734</span>&#160; </div>
<div class="line"><a name="l00735"></a><span class="lineno">  735</span>&#160;  <span class="keyword">auto</span> pos_args_it = this-&gt;positional_args_list.begin();</div>
<div class="line"><a name="l00736"></a><span class="lineno">  736</span>&#160;  <span class="keywordflow">for</span> (<span class="keyword">auto</span> it = args.begin(); it != args.end(); ++it) {</div>
<div class="line"><a name="l00737"></a><span class="lineno">  737</span>&#160; </div>
<div class="line"><a name="l00738"></a><span class="lineno">  738</span>&#160;    <span class="keyword">const</span> std::string token = *it;</div>
<div class="line"><a name="l00739"></a><span class="lineno">  739</span>&#160; </div>
<div class="line"><a name="l00740"></a><span class="lineno">  740</span>&#160;    <span class="keywordflow">if</span> (this-&gt;help_tokens.count(token))</div>
<div class="line"><a name="l00741"></a><span class="lineno">  741</span>&#160;      stop(<span class="stringliteral">&quot;&quot;</span>);</div>
<div class="line"><a name="l00742"></a><span class="lineno">  742</span>&#160; </div>
<div class="line"><a name="l00743"></a><span class="lineno">  743</span>&#160;    <span class="comment">// Check if not called before</span></div>
<div class="line"><a name="l00744"></a><span class="lineno">  744</span>&#160;    <span class="keywordflow">if</span> (!duplicates &amp;&amp; this-&gt;previous_call_set.count(token))</div>
<div class="line"><a name="l00745"></a><span class="lineno">  745</span>&#160;      stop(<span class="stringliteral">&quot;Attempting to set same variable &#39;&quot;</span> + token + <span class="stringliteral">&quot;&#39; twice.&quot;</span>);</div>
<div class="line"><a name="l00746"></a><span class="lineno">  746</span>&#160; </div>
<div class="line"><a name="l00747"></a><span class="lineno">  747</span>&#160;    <span class="comment">// Select ArgProcessor</span></div>
<div class="line"><a name="l00748"></a><span class="lineno">  748</span>&#160;    <span class="keyword">auto</span> map_it = this-&gt;map.find(token);</div>
<div class="line"><a name="l00749"></a><span class="lineno">  749</span>&#160;    std::shared_ptr&lt;ArgProcessor&gt; ap =</div>
<div class="line"><a name="l00750"></a><span class="lineno">  750</span>&#160;        (map_it == this-&gt;map.end()) ? <span class="keyword">nullptr</span> : map_it-&gt;second;</div>
<div class="line"><a name="l00751"></a><span class="lineno">  751</span>&#160; </div>
<div class="line"><a name="l00752"></a><span class="lineno">  752</span>&#160;    if (ap &amp;&amp; ap-&gt;getArgType() != ArgType::POSITIONAL) {</div>
<div class="line"><a name="l00753"></a><span class="lineno">  753</span>&#160; </div>
<div class="line"><a name="l00754"></a><span class="lineno">  754</span>&#160;      <span class="keywordflow">switch</span> (ap-&gt;getArgType()) {</div>
<div class="line"><a name="l00755"></a><span class="lineno">  755</span>&#160;      <span class="keywordflow">case</span> ArgType::NAMED:</div>
<div class="line"><a name="l00756"></a><span class="lineno">  756</span>&#160;        <span class="comment">// Process value (parse and set)</span></div>
<div class="line"><a name="l00757"></a><span class="lineno">  757</span>&#160;        <span class="keywordflow">if</span> ((++it) == args.end())</div>
<div class="line"><a name="l00758"></a><span class="lineno">  758</span>&#160;          stop(<span class="stringliteral">&quot;Dangling value for named argument &#39;&quot;</span> + token + <span class="stringliteral">&quot;&#39;.&quot;</span>);</div>
<div class="line"><a name="l00759"></a><span class="lineno">  759</span>&#160; </div>
<div class="line"><a name="l00760"></a><span class="lineno">  760</span>&#160;        <span class="keywordflow">if</span> (this-&gt;kv_separator == <span class="charliteral">&#39; &#39;</span>) {</div>
<div class="line"><a name="l00761"></a><span class="lineno">  761</span>&#160;          <span class="keywordflow">if</span> (!ap-&gt;process(*it))</div>
<div class="line"><a name="l00762"></a><span class="lineno">  762</span>&#160;            stop(<span class="stringliteral">&quot;Whitespace separator issue. Value:&#39;&quot;</span> + *it + <span class="stringliteral">&quot;&#39;&quot;</span>);</div>
<div class="line"><a name="l00763"></a><span class="lineno">  763</span>&#160;        } <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00764"></a><span class="lineno">  764</span>&#160;          <span class="keywordflow">if</span> ((++it) == args.end())</div>
<div class="line"><a name="l00765"></a><span class="lineno">  765</span>&#160;            stop(<span class="stringliteral">&quot;Dangling value for named argument &#39;&quot;</span> + token +</div>
<div class="line"><a name="l00766"></a><span class="lineno">  766</span>&#160;                 <span class="stringliteral">&quot;&#39; after separator.&quot;</span>);</div>
<div class="line"><a name="l00767"></a><span class="lineno">  767</span>&#160;          <span class="keywordflow">if</span> (!ap-&gt;process(*it))</div>
<div class="line"><a name="l00768"></a><span class="lineno">  768</span>&#160;            stop(<span class="stringliteral">&quot;Not a valid value &#39;&quot;</span> + *it + <span class="stringliteral">&quot;&#39;.&quot;</span>);</div>
<div class="line"><a name="l00769"></a><span class="lineno">  769</span>&#160;        }</div>
<div class="line"><a name="l00770"></a><span class="lineno">  770</span>&#160;        <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00771"></a><span class="lineno">  771</span>&#160;      <span class="keywordflow">case</span> ArgType::TOGGLE_TRUE:</div>
<div class="line"><a name="l00772"></a><span class="lineno">  772</span>&#160;        <span class="keywordflow">if</span> (!ap-&gt;process(<span class="stringliteral">&quot;1&quot;</span>))</div>
<div class="line"><a name="l00773"></a><span class="lineno">  773</span>&#160;          stop(<span class="stringliteral">&quot;&quot;</span>);</div>
<div class="line"><a name="l00774"></a><span class="lineno">  774</span>&#160;        <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00775"></a><span class="lineno">  775</span>&#160;      <span class="keywordflow">case</span> ArgType::TOGGLE_FALSE:</div>
<div class="line"><a name="l00776"></a><span class="lineno">  776</span>&#160;        <span class="keywordflow">if</span> (!ap-&gt;process(<span class="stringliteral">&quot;0&quot;</span>))</div>
<div class="line"><a name="l00777"></a><span class="lineno">  777</span>&#160;          stop(<span class="stringliteral">&quot;&quot;</span>);</div>
<div class="line"><a name="l00778"></a><span class="lineno">  778</span>&#160;        <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00779"></a><span class="lineno">  779</span>&#160;      <span class="keywordflow">default</span>:</div>
<div class="line"><a name="l00780"></a><span class="lineno">  780</span>&#160;        <span class="comment">// Should never get here.</span></div>
<div class="line"><a name="l00781"></a><span class="lineno">  781</span>&#160;        <span class="keywordflow">throw</span> LogicError(<span class="stringliteral">&quot;Unrecognised ArgType.&quot;</span>);</div>
<div class="line"><a name="l00782"></a><span class="lineno">  782</span>&#160;        <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00783"></a><span class="lineno">  783</span>&#160;      }</div>
<div class="line"><a name="l00784"></a><span class="lineno">  784</span>&#160; </div>
<div class="line"><a name="l00785"></a><span class="lineno">  785</span>&#160;      <span class="comment">// Remove from required_set (if it is there)</span></div>
<div class="line"><a name="l00786"></a><span class="lineno">  786</span>&#160;      this-&gt;required_set.erase(token);</div>
<div class="line"><a name="l00787"></a><span class="lineno">  787</span>&#160; </div>
<div class="line"><a name="l00788"></a><span class="lineno">  788</span>&#160;      <span class="comment">// Previously called.</span></div>
<div class="line"><a name="l00789"></a><span class="lineno">  789</span>&#160;      this-&gt;previous_call_set.insert(token);</div>
<div class="line"><a name="l00790"></a><span class="lineno">  790</span>&#160;    } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (pos_args_it != this-&gt;positional_args_list.end()) {</div>
<div class="line"><a name="l00791"></a><span class="lineno">  791</span>&#160;      <span class="comment">// POSITIONAL args are treated differently as it is technically</span></div>
<div class="line"><a name="l00792"></a><span class="lineno">  792</span>&#160;      <span class="comment">// never a recognised token.</span></div>
<div class="line"><a name="l00793"></a><span class="lineno">  793</span>&#160;      std::shared_ptr&lt;ArgProcessor&gt; pos_ap = map.find(*pos_args_it)-&gt;second;</div>
<div class="line"><a name="l00794"></a><span class="lineno">  794</span>&#160;      if (!pos_ap-&gt;process(*it))</div>
<div class="line"><a name="l00795"></a><span class="lineno">  795</span>&#160;        <span class="keywordflow">throw</span> LogicError(<span class="stringliteral">&quot;Positional name does not match a ArgMap name.&quot;</span>);</div>
<div class="line"><a name="l00796"></a><span class="lineno">  796</span>&#160;      <span class="comment">// Remove from required_set (if it is there)</span></div>
<div class="line"><a name="l00797"></a><span class="lineno">  797</span>&#160;      this-&gt;required_set.erase(*pos_args_it);</div>
<div class="line"><a name="l00798"></a><span class="lineno">  798</span>&#160;      ++pos_args_it;</div>
<div class="line"><a name="l00799"></a><span class="lineno">  799</span>&#160;    } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (this-&gt;dots_enabled) {</div>
<div class="line"><a name="l00800"></a><span class="lineno">  800</span>&#160;      this-&gt;dots_ap-&gt;process(token);</div>
<div class="line"><a name="l00801"></a><span class="lineno">  801</span>&#160;    } <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00802"></a><span class="lineno">  802</span>&#160;      std::string msg = <span class="stringliteral">&quot;Unrecognised argument \&#39;&quot;</span> + token + <span class="stringliteral">&quot;\&#39;&quot;</span>;</div>
<div class="line"><a name="l00803"></a><span class="lineno">  803</span>&#160;      <span class="keywordflow">if</span> (!this-&gt;positional_args_list.empty())</div>
<div class="line"><a name="l00804"></a><span class="lineno">  804</span>&#160;        msg += <span class="stringliteral">&quot;\nThere could be too many positional arguments&quot;</span>;</div>
<div class="line"><a name="l00805"></a><span class="lineno">  805</span>&#160;      stop(msg);</div>
<div class="line"><a name="l00806"></a><span class="lineno">  806</span>&#160;    }</div>
<div class="line"><a name="l00807"></a><span class="lineno">  807</span>&#160;  }</div>
<div class="line"><a name="l00808"></a><span class="lineno">  808</span>&#160;}</div>
<div class="line"><a name="l00809"></a><span class="lineno">  809</span>&#160; </div>
<div class="line"><a name="l00810"></a><span class="lineno"><a class="line" href="classhelib_1_1_arg_map.html#a89eee5d391a2fd41b6b6c4b545b159b7">  810</a></span>&#160;<span class="keyword">inline</span> <a class="code" href="classhelib_1_1_arg_map.html">ArgMap</a>&amp; <a class="code" href="classhelib_1_1_arg_map.html#a89eee5d391a2fd41b6b6c4b545b159b7">ArgMap::parse</a>(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span>** argv)</div>
<div class="line"><a name="l00811"></a><span class="lineno">  811</span>&#160;{</div>
<div class="line"><a name="l00812"></a><span class="lineno">  812</span>&#160;  this-&gt;progname = std::string(argv[0]);</div>
<div class="line"><a name="l00813"></a><span class="lineno">  813</span>&#160; </div>
<div class="line"><a name="l00814"></a><span class="lineno">  814</span>&#160;  std::forward_list&lt;std::string&gt; args(argv + 1, argv + argc);</div>
<div class="line"><a name="l00815"></a><span class="lineno">  815</span>&#160; </div>
<div class="line"><a name="l00816"></a><span class="lineno">  816</span>&#160;  splitOnSeparator(args, this-&gt;kv_separator);</div>
<div class="line"><a name="l00817"></a><span class="lineno">  817</span>&#160; </div>
<div class="line"><a name="l00818"></a><span class="lineno">  818</span>&#160;  <span class="comment">// Take any leading and trailing whitespace away.</span></div>
<div class="line"><a name="l00819"></a><span class="lineno">  819</span>&#160;  std::for_each(args.begin(), args.end(), strip);</div>
<div class="line"><a name="l00820"></a><span class="lineno">  820</span>&#160; </div>
<div class="line"><a name="l00821"></a><span class="lineno">  821</span>&#160;  printDiagnostics(args);</div>
<div class="line"><a name="l00822"></a><span class="lineno">  822</span>&#160; </div>
<div class="line"><a name="l00823"></a><span class="lineno">  823</span>&#160;  simpleParse(args);</div>
<div class="line"><a name="l00824"></a><span class="lineno">  824</span>&#160; </div>
<div class="line"><a name="l00825"></a><span class="lineno">  825</span>&#160;  <span class="comment">// Have the required args been provided - if not exit</span></div>
<div class="line"><a name="l00826"></a><span class="lineno">  826</span>&#160;  <span class="keywordflow">if</span> (!this-&gt;required_set.empty()) {</div>
<div class="line"><a name="l00827"></a><span class="lineno">  827</span>&#160;    std::ostringstream oss;</div>
<div class="line"><a name="l00828"></a><span class="lineno">  828</span>&#160;    oss &lt;&lt; <span class="stringliteral">&quot;Required argument(s) not given:\n&quot;</span>;</div>
<div class="line"><a name="l00829"></a><span class="lineno">  829</span>&#160;    <span class="keywordflow">for</span> (<span class="keyword">const</span> <span class="keyword">auto</span>&amp; e : this-&gt;required_set)</div>
<div class="line"><a name="l00830"></a><span class="lineno">  830</span>&#160;      oss &lt;&lt; <span class="stringliteral">&quot;\t&quot;</span> &lt;&lt; e &lt;&lt; <span class="charliteral">&#39;\n&#39;</span>;</div>
<div class="line"><a name="l00831"></a><span class="lineno">  831</span>&#160;    <a class="code" href="classhelib_1_1_arg_map.html#a383d5eb53291ab618eebeb60c2112dde">usage</a>(oss.str()); <span class="comment">// exits</span></div>
<div class="line"><a name="l00832"></a><span class="lineno">  832</span>&#160;  }</div>
<div class="line"><a name="l00833"></a><span class="lineno">  833</span>&#160; </div>
<div class="line"><a name="l00834"></a><span class="lineno">  834</span>&#160;  <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
<div class="line"><a name="l00835"></a><span class="lineno">  835</span>&#160;}</div>
<div class="line"><a name="l00836"></a><span class="lineno">  836</span>&#160; </div>
<div class="line"><a name="l00837"></a><span class="lineno"><a class="line" href="classhelib_1_1_arg_map.html#a5c4e6cd32fd18c78bc02d11f74bf115b">  837</a></span>&#160;<span class="keyword">inline</span> <a class="code" href="classhelib_1_1_arg_map.html">ArgMap</a>&amp; <a class="code" href="classhelib_1_1_arg_map.html#a89eee5d391a2fd41b6b6c4b545b159b7">ArgMap::parse</a>(<span class="keyword">const</span> std::string&amp; filepath)</div>
<div class="line"><a name="l00838"></a><span class="lineno">  838</span>&#160;{</div>
<div class="line"><a name="l00839"></a><span class="lineno">  839</span>&#160; </div>
<div class="line"><a name="l00840"></a><span class="lineno">  840</span>&#160;  <span class="keywordflow">if</span> (this-&gt;kv_separator == <span class="charliteral">&#39; &#39;</span>) { <span class="comment">// Not from files.</span></div>
<div class="line"><a name="l00841"></a><span class="lineno">  841</span>&#160;    <span class="keywordflow">throw</span> <a class="code" href="classhelib_1_1_logic_error.html">LogicError</a>(<span class="stringliteral">&quot;Whitespace separator not possible from files.&quot;</span>);</div>
<div class="line"><a name="l00842"></a><span class="lineno">  842</span>&#160;  }</div>
<div class="line"><a name="l00843"></a><span class="lineno">  843</span>&#160; </div>
<div class="line"><a name="l00844"></a><span class="lineno">  844</span>&#160;  <span class="keywordflow">if</span> (!this-&gt;named_args_only) {</div>
<div class="line"><a name="l00845"></a><span class="lineno">  845</span>&#160;    <span class="keywordflow">throw</span> <a class="code" href="classhelib_1_1_logic_error.html">LogicError</a>(<span class="stringliteral">&quot;Toggle and Positional arguments not possible from &quot;</span></div>
<div class="line"><a name="l00846"></a><span class="lineno">  846</span>&#160;                     <span class="stringliteral">&quot;files. Only named arguments.&quot;</span>);</div>
<div class="line"><a name="l00847"></a><span class="lineno">  847</span>&#160;  }</div>
<div class="line"><a name="l00848"></a><span class="lineno">  848</span>&#160; </div>
<div class="line"><a name="l00849"></a><span class="lineno">  849</span>&#160;  std::ifstream file(filepath);</div>
<div class="line"><a name="l00850"></a><span class="lineno">  850</span>&#160;  this-&gt;progname = filepath;</div>
<div class="line"><a name="l00851"></a><span class="lineno">  851</span>&#160; </div>
<div class="line"><a name="l00852"></a><span class="lineno">  852</span>&#160;  <span class="keywordflow">if</span> (!file.is_open()) {</div>
<div class="line"><a name="l00853"></a><span class="lineno">  853</span>&#160;    <span class="keywordflow">throw</span> <a class="code" href="classhelib_1_1_runtime_error.html">RuntimeError</a>(<span class="stringliteral">&quot;Could not open file &#39;&quot;</span> + filepath + <span class="stringliteral">&quot;&#39;.&quot;</span>);</div>
<div class="line"><a name="l00854"></a><span class="lineno">  854</span>&#160;  }</div>
<div class="line"><a name="l00855"></a><span class="lineno">  855</span>&#160; </div>
<div class="line"><a name="l00856"></a><span class="lineno">  856</span>&#160;  std::forward_list&lt;std::string&gt; args;</div>
<div class="line"><a name="l00857"></a><span class="lineno">  857</span>&#160;  <span class="keyword">auto</span> it = args.before_begin();</div>
<div class="line"><a name="l00858"></a><span class="lineno">  858</span>&#160;  std::regex re_comment_lines(R<span class="stringliteral">&quot;((^\s*\#)|(^\s+$))&quot;);</span></div>
<div class="line"><a name="l00859"></a><span class="lineno">  859</span>&#160;<span class="stringliteral">  std::string line;</span></div>
<div class="line"><a name="l00860"></a><span class="lineno">  860</span>&#160;<span class="stringliteral">  </span><span class="keywordflow">while</span> (getline(file, line)) {</div>
<div class="line"><a name="l00861"></a><span class="lineno">  861</span>&#160;    <span class="keywordflow">if</span> (line.empty() || std::regex_search(line, re_comment_lines)) {</div>
<div class="line"><a name="l00862"></a><span class="lineno">  862</span>&#160;      <span class="keywordflow">continue</span>; <span class="comment">// ignore comment lines and empties.</span></div>
<div class="line"><a name="l00863"></a><span class="lineno">  863</span>&#160;    }</div>
<div class="line"><a name="l00864"></a><span class="lineno">  864</span>&#160;    it = args.insert_after(it, line);</div>
<div class="line"><a name="l00865"></a><span class="lineno">  865</span>&#160;  }</div>
<div class="line"><a name="l00866"></a><span class="lineno">  866</span>&#160; </div>
<div class="line"><a name="l00867"></a><span class="lineno">  867</span>&#160;  splitOnSeparator(args, this-&gt;kv_separator);</div>
<div class="line"><a name="l00868"></a><span class="lineno">  868</span>&#160; </div>
<div class="line"><a name="l00869"></a><span class="lineno">  869</span>&#160;  <span class="comment">// Take any leading and trailing whitespace away.</span></div>
<div class="line"><a name="l00870"></a><span class="lineno">  870</span>&#160;  std::for_each(args.begin(), args.end(), strip);</div>
<div class="line"><a name="l00871"></a><span class="lineno">  871</span>&#160; </div>
<div class="line"><a name="l00872"></a><span class="lineno">  872</span>&#160;  printDiagnostics(args);</div>
<div class="line"><a name="l00873"></a><span class="lineno">  873</span>&#160; </div>
<div class="line"><a name="l00874"></a><span class="lineno">  874</span>&#160;  simpleParse(args, <span class="keyword">false</span>, [&amp;filepath](<span class="keyword">const</span> std::string&amp; msg) {</div>
<div class="line"><a name="l00875"></a><span class="lineno">  875</span>&#160;    <span class="keywordflow">throw</span> <a class="code" href="classhelib_1_1_runtime_error.html">RuntimeError</a>(<span class="stringliteral">&quot;Could not parse params file: &#39;&quot;</span> + filepath + <span class="stringliteral">&quot;&#39;. &quot;</span> +</div>
<div class="line"><a name="l00876"></a><span class="lineno">  876</span>&#160;                       msg);</div>
<div class="line"><a name="l00877"></a><span class="lineno">  877</span>&#160;  });</div>
<div class="line"><a name="l00878"></a><span class="lineno">  878</span>&#160; </div>
<div class="line"><a name="l00879"></a><span class="lineno">  879</span>&#160;  <span class="comment">// Have the required args been provided - if not throw</span></div>
<div class="line"><a name="l00880"></a><span class="lineno">  880</span>&#160;  <span class="keywordflow">if</span> (!this-&gt;required_set.empty()) {</div>
<div class="line"><a name="l00881"></a><span class="lineno">  881</span>&#160;    std::ostringstream oss;</div>
<div class="line"><a name="l00882"></a><span class="lineno">  882</span>&#160;    oss &lt;&lt; <span class="stringliteral">&quot;Required argument(s) not given:\n&quot;</span>;</div>
<div class="line"><a name="l00883"></a><span class="lineno">  883</span>&#160;    <span class="keywordflow">for</span> (<span class="keyword">const</span> <span class="keyword">auto</span>&amp; e : this-&gt;required_set)</div>
<div class="line"><a name="l00884"></a><span class="lineno">  884</span>&#160;      oss &lt;&lt; <span class="stringliteral">&quot;\t&quot;</span> &lt;&lt; e &lt;&lt; <span class="charliteral">&#39;\n&#39;</span>;</div>
<div class="line"><a name="l00885"></a><span class="lineno">  885</span>&#160;    <span class="keywordflow">throw</span> <a class="code" href="classhelib_1_1_runtime_error.html">RuntimeError</a>(oss.str());</div>
<div class="line"><a name="l00886"></a><span class="lineno">  886</span>&#160;  }</div>
<div class="line"><a name="l00887"></a><span class="lineno">  887</span>&#160; </div>
<div class="line"><a name="l00888"></a><span class="lineno">  888</span>&#160;  <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
<div class="line"><a name="l00889"></a><span class="lineno">  889</span>&#160;}</div>
<div class="line"><a name="l00890"></a><span class="lineno">  890</span>&#160; </div>
<div class="line"><a name="l00891"></a><span class="lineno">  891</span>&#160;} <span class="comment">// namespace helib</span></div>
<div class="line"><a name="l00892"></a><span class="lineno">  892</span>&#160; </div>
<div class="line"><a name="l00893"></a><span class="lineno">  893</span>&#160;<span class="preprocessor">#endif // ifndef HELIB_ARGMAP_H</span></div>
</div><!-- fragment --></div><!-- contents -->
<div class="ttc" id="aclasshelib_1_1_arg_map_html_a7bcbfcccc0c9fcc9f3eba06067fcd97f"><div class="ttname"><a href="classhelib_1_1_arg_map.html#a7bcbfcccc0c9fcc9f3eba06067fcd97f">helib::ArgMap::note</a></div><div class="ttdeci">ArgMap &amp; note(const std::string &amp;s)</div><div class="ttdoc">Adds a note to usage Adds a note to the arg usage description.</div><div class="ttdef"><b>Definition:</b> ArgMap.h:569</div></div>
<div class="ttc" id="astructhelib_1_1_arg_map_1_1_arg_processor_html_a19c15b33dcfd8ee176b1e6c22d1afe68"><div class="ttname"><a href="structhelib_1_1_arg_map_1_1_arg_processor.html#a19c15b33dcfd8ee176b1e6c22d1afe68">helib::ArgMap::ArgProcessor::process</a></div><div class="ttdeci">virtual bool process(const std::string &amp;s)=0</div></div>
<div class="ttc" id="aclasshelib_1_1_runtime_error_html"><div class="ttname"><a href="classhelib_1_1_runtime_error.html">helib::RuntimeError</a></div><div class="ttdoc">Inherits from Exception and std::runtime_error.</div><div class="ttdef"><b>Definition:</b> exceptions.h:105</div></div>
<div class="ttc" id="anamespacehelib_html_ad94835a294c90ee0ea0336561c8f38ad"><div class="ttname"><a href="namespacehelib.html#ad94835a294c90ee0ea0336561c8f38ad">helib::empty</a></div><div class="ttdeci">bool empty(const IndexSet &amp;s)</div><div class="ttdef"><b>Definition:</b> IndexSet.h:182</div></div>
<div class="ttc" id="aclasshelib_1_1_arg_map_html_a383d5eb53291ab618eebeb60c2112dde"><div class="ttname"><a href="classhelib_1_1_arg_map.html#a383d5eb53291ab618eebeb60c2112dde">helib::ArgMap::usage</a></div><div class="ttdeci">void usage(const std::string &amp;msg=&quot;&quot;) const</div><div class="ttdoc">Print usage and exit Prints the usage and exits the program.</div><div class="ttdef"><b>Definition:</b> ArgMap.h:575</div></div>
<div class="ttc" id="aclasshelib_1_1_arg_map_html_aa7dcd50df0466cd4be10a94eb3f96d1b"><div class="ttname"><a href="classhelib_1_1_arg_map.html#aa7dcd50df0466cd4be10a94eb3f96d1b">helib::ArgMap::required</a></div><div class="ttdeci">ArgMap &amp; required()</div><div class="ttdoc">Swaps to required arg mode Swaps to required arg mode. Following arguments will be considered require...</div><div class="ttdef"><b>Definition:</b> ArgMap.h:655</div></div>
<div class="ttc" id="aclasshelib_1_1_logic_error_html"><div class="ttname"><a href="classhelib_1_1_logic_error.html">helib::LogicError</a></div><div class="ttdoc">Inherits from Exception and std::logic_error.</div><div class="ttdef"><b>Definition:</b> exceptions.h:68</div></div>
<div class="ttc" id="astructhelib_1_1_arg_map_1_1_arg_processor_html"><div class="ttname"><a href="structhelib_1_1_arg_map_1_1_arg_processor.html">helib::ArgMap::ArgProcessor</a></div><div class="ttdef"><b>Definition:</b> ArgMap.h:403</div></div>
<div class="ttc" id="astructhelib_1_1_arg_map_1_1_arg_processor_html_afdec15131d585403483783f150f90bb6"><div class="ttname"><a href="structhelib_1_1_arg_map_1_1_arg_processor.html#afdec15131d585403483783f150f90bb6">helib::ArgMap::ArgProcessor::~ArgProcessor</a></div><div class="ttdeci">virtual ~ArgProcessor()=default</div></div>
<div class="ttc" id="aclasshelib_1_1_arg_map_html_a89eee5d391a2fd41b6b6c4b545b159b7"><div class="ttname"><a href="classhelib_1_1_arg_map.html#a89eee5d391a2fd41b6b6c4b545b159b7">helib::ArgMap::parse</a></div><div class="ttdeci">ArgMap &amp; parse(int argc, char **argv)</div><div class="ttdoc">Parse the argv array Parse the argv array If it fails or -h is an argument it prints the usage and ex...</div><div class="ttdef"><b>Definition:</b> ArgMap.h:810</div></div>
<div class="ttc" id="anamespacehelib_html_a305064dc4866c160a571bd653556c113"><div class="ttname"><a href="namespacehelib.html#a305064dc4866c160a571bd653556c113">helib::sub</a></div><div class="ttdeci">void sub(const EncryptedArray &amp;ea, PlaintextArray &amp;pa, const PlaintextArray &amp;other)</div><div class="ttdef"><b>Definition:</b> EncryptedArray.cpp:1036</div></div>
<div class="ttc" id="aclasshelib_1_1_arg_map_html_ae477d3e97e6b9f4e847b7976fc939992"><div class="ttname"><a href="classhelib_1_1_arg_map.html#ae477d3e97e6b9f4e847b7976fc939992">helib::ArgMap::separator</a></div><div class="ttdeci">ArgMap &amp; separator(Separator s)</div><div class="ttdoc">Sets the key-value separator Sets the named args key-value pair separator character.</div><div class="ttdef"><b>Definition:</b> ArgMap.h:629</div></div>
<div class="ttc" id="aclasshelib_1_1_arg_map_html_ac06dd5e3726ecd5d8e688d665c2c9e50"><div class="ttname"><a href="classhelib_1_1_arg_map.html#ac06dd5e3726ecd5d8e688d665c2c9e50">helib::ArgMap::named</a></div><div class="ttdeci">ArgMap &amp; named()</div><div class="ttdoc">Swaps to named arg type (default) Swaps to required arg mode. Following arguments will be considered ...</div><div class="ttdef"><b>Definition:</b> ArgMap.h:668</div></div>
<div class="ttc" id="astructhelib_1_1_arg_map_1_1_arg_processor_html_a76d699586ece388055ccd708a273bfbf"><div class="ttname"><a href="structhelib_1_1_arg_map_1_1_arg_processor.html#a76d699586ece388055ccd708a273bfbf">helib::ArgMap::ArgProcessor::getArgType</a></div><div class="ttdeci">virtual ArgType getArgType()=0</div></div>
<div class="ttc" id="aclasshelib_1_1_arg_map_html_ac96d090b5476e9a39b41ae27d74641b0af65f22e75defc168edfc6444e6aaf4f8"><div class="ttname"><a href="classhelib_1_1_arg_map.html#ac96d090b5476e9a39b41ae27d74641b0af65f22e75defc168edfc6444e6aaf4f8">helib::ArgMap::Separator::COLON</a></div><div class="ttdeci">@ COLON</div></div>
<div class="ttc" id="aclasshelib_1_1_arg_map_html"><div class="ttname"><a href="classhelib_1_1_arg_map.html">helib::ArgMap</a></div><div class="ttdoc">Basic class for arg parsing. Example use:</div><div class="ttdef"><b>Definition:</b> ArgMap.h:73</div></div>
<div class="ttc" id="aclasshelib_1_1_arg_map_html_af54e2d261ed329d3b3b2e2cfbf35ab80"><div class="ttname"><a href="classhelib_1_1_arg_map.html#af54e2d261ed329d3b3b2e2cfbf35ab80">helib::ArgMap::diagnostics</a></div><div class="ttdeci">ArgMap &amp; diagnostics(std::ostream &amp;ostrm=std::cout)</div><div class="ttdoc">Turns on diagnostics printout when parsing Swaps to required arg mode. Following arguments will be co...</div><div class="ttdef"><b>Definition:</b> ArgMap.h:681</div></div>
<div class="ttc" id="aclasshelib_1_1_arg_map_html_a0ecab734381e89bf13e2dd38af25585c"><div class="ttname"><a href="classhelib_1_1_arg_map.html#a0ecab734381e89bf13e2dd38af25585c">helib::ArgMap::helpArgs</a></div><div class="ttdeci">ArgMap &amp; helpArgs(const std::initializer_list&lt; std::string &gt; s)</div><div class="ttdoc">Provide custom help toggle args. (defaults are &quot;-h&quot;, &quot;--help&quot;) Overwrite default help toggle args to ...</div><div class="ttdef"><b>Definition:</b> ArgMap.h:617</div></div>
<div class="ttc" id="aclasshelib_1_1_arg_map_html_ac96d090b5476e9a39b41ae27d74641b0a6837aeca94b8f55801166eb031e26a5a"><div class="ttname"><a href="classhelib_1_1_arg_map.html#ac96d090b5476e9a39b41ae27d74641b0a6837aeca94b8f55801166eb031e26a5a">helib::ArgMap::Separator::EQUALS</a></div><div class="ttdeci">@ EQUALS</div></div>
<div class="ttc" id="aclasshelib_1_1_arg_map_html_ac96d090b5476e9a39b41ae27d74641b0a52f1e315372b38db1b8f4e3666c4f721"><div class="ttname"><a href="classhelib_1_1_arg_map.html#ac96d090b5476e9a39b41ae27d74641b0a52f1e315372b38db1b8f4e3666c4f721">helib::ArgMap::Separator::WHITESPACE</a></div><div class="ttdeci">@ WHITESPACE</div></div>
<div class="ttc" id="aclasshelib_1_1_arg_map_html_af838c44fcb91c73284de3cbf993861f2"><div class="ttname"><a href="classhelib_1_1_arg_map.html#af838c44fcb91c73284de3cbf993861f2">helib::ArgMap::toggle</a></div><div class="ttdeci">ArgMap &amp; toggle(bool t=true)</div><div class="ttdoc">Swaps to toggle arg type Swaps to required arg mode. Following arguments will be considered of toggle...</div><div class="ttdef"><b>Definition:</b> ArgMap.h:661</div></div>
<div class="ttc" id="anamespacehelib_html"><div class="ttname"><a href="namespacehelib.html">helib</a></div><div class="ttdef"><b>Definition:</b> apiAttributes.h:21</div></div>
<div class="ttc" id="aclasshelib_1_1_arg_map_html_a8e2a662a2283329301f6d7b5e0e845c8"><div class="ttname"><a href="classhelib_1_1_arg_map.html#a8e2a662a2283329301f6d7b5e0e845c8">helib::ArgMap::dots</a></div><div class="ttdeci">ArgMap &amp; dots(C &amp;container, const char *name)</div><div class="ttdoc">Adds variable number of positional arg types after defined arg types are exhausted....</div><div class="ttdef"><b>Definition:</b> ArgMap.h:554</div></div>
<div class="ttc" id="aclasshelib_1_1_arg_map_html_adf55e7e52a63bd72fe212cb90e58ad64"><div class="ttname"><a href="classhelib_1_1_arg_map.html#adf55e7e52a63bd72fe212cb90e58ad64">helib::ArgMap::positional</a></div><div class="ttdeci">ArgMap &amp; positional()</div><div class="ttdoc">Swaps to positional arg type Swaps to required arg mode. Following arguments will be considered of po...</div><div class="ttdef"><b>Definition:</b> ArgMap.h:674</div></div>
<div class="ttc" id="aclasshelib_1_1_arg_map_html_a39ddbc25b7e1b038dbab65d5c1383b50"><div class="ttname"><a href="classhelib_1_1_arg_map.html#a39ddbc25b7e1b038dbab65d5c1383b50">helib::ArgMap::optional</a></div><div class="ttdeci">ArgMap &amp; optional()</div><div class="ttdoc">Swaps to optional arg mode (default) Swaps to optional arg mode. Following arguments will be consider...</div><div class="ttdef"><b>Definition:</b> ArgMap.h:649</div></div>
<div class="ttc" id="aclasshelib_1_1_arg_map_html_a72a8c34a4d72036f02d3bb3cc6f754d2"><div class="ttname"><a href="classhelib_1_1_arg_map.html#a72a8c34a4d72036f02d3bb3cc6f754d2">helib::ArgMap::arg</a></div><div class="ttdeci">ArgMap &amp; arg(const std::string &amp;name, T &amp;value)</div><div class="ttdoc">Add a new argument description Adds a new argument description with value of type T....</div><div class="ttdef"><b>Definition:</b> ArgMap.h:486</div></div>
<div class="ttc" id="aclasshelib_1_1_arg_map_html_ac96d090b5476e9a39b41ae27d74641b0"><div class="ttname"><a href="classhelib_1_1_arg_map.html#ac96d090b5476e9a39b41ae27d74641b0">helib::ArgMap::Separator</a></div><div class="ttdeci">Separator</div><div class="ttdef"><b>Definition:</b> ArgMap.h:181</div></div>
<div class="ttc" id="aclasshelib_1_1_arg_map_html_a7665dba84ba3a420e052a61eb6c4e30f"><div class="ttname"><a href="classhelib_1_1_arg_map.html#a7665dba84ba3a420e052a61eb6c4e30f">helib::ArgMap::doc</a></div><div class="ttdeci">std::string doc() const</div><div class="ttdoc">Return arg docs Returns the argument documentation as a string.</div><div class="ttdef"><b>Definition:</b> ArgMap.h:709</div></div>
<div class="ttc" id="aassertions_8h_html"><div class="ttname"><a href="assertions_8h.html">assertions.h</a></div><div class="ttdoc">Various assertion functions for use within HElib. These are meant as a replacement for C-style assert...</div></div>
<!-- HTML footer for doxygen 1.8.8-->
<!-- start footer part -->
</div>
</div>
</div>
</div>
</div>
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.18
</small></address>
</body>
        <script type="text/javascript" src="doxy-boot.js"></script>
</html>
